RosettaCodeData/Task/Call-a-foreign-language-function/R/call-a-foreign-language-function-2.r

7 lines
190 B
R
Raw Permalink Normal View History

2026-04-30 12:34:36 -04:00
s <- "Hello World!"
system("R CMD SHLIB rtask.c")
dyn.load("rtask.dll")
#Output from .C() is always a list, so take only the first element from it
result <- .C("test", s)[[1]]
print(result)