Hello, I try to incorporate C code in R.
suppose I have the following C code: #include <R.h> #include <stdio.h> int main(int *n) { int i; for(i=0; i < *n; i++) { printf("Hello, world!\n"); } } in a file named "hello.c". First I make: g++ -c hello.c -o hello.o -I "/Library/Frameworks/R.framework/Versions/2.8/Headers/" g++ -dynamic hello.o -o hello.so I work on mac, and that's why I have to set the -dynamic option. First of all, I don't understand why I have to specify the path to R.h, but if I don't, R.h isn't found. My problem is the following: once the .so is generated, without any warning or error, I open my R envirronment and type > dyn.load("/path/to/my/hello.so") then push on enter, and then R runs hours, without giving me the command invite again. What am I doing wrong? Thank you.
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.