[Rd] free variable, built-in R functions
Hi, I have one question about built-in R functions. I am looking into interprocedural analysis and since R supports "free variable", it would become complicated if free variable is read inside a function. It is uncommon and probably not good to read free variables when implementing R functions. I suppose R built-in functions don't read free variables (therefore don't depend on global variables). Could someone in the development team confirm about that? Thank you very much. Best regards, Jiangtian __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] problem in linking to libR.so with R 2.5.0
Dear All, I tried to write a C++ program that uses R internals and I encounter "undefined reference" error when linking to libR.so. Here is an small example of the program test.cpp: extern "C" { #include #include int main(int argc, char** argv) { R_IoBufferInit(&R_ConsoleIob); return 0; } } I built it using: g++ -o test -I/dir/to/R-2.5.0/src/include -L/dir/to/R-2.5.0/lib/R/lib -lR test.cpp and I got the error message: /tmp/cc4zxrqh.o(.text+0x20): In function `main': test.cpp: undefined reference to `R_ConsoleIob' /tmp/cc4zxrqh.o(.text+0x25):test.cpp: undefined reference to `R_IoBufferInit' collect2: ld returned 1 exit status I installed R 2.5.0 on Fedora Core 4 with gcc 4.0.2 and configured with --prefix=/dir/to/R-2.5.0 --enable-R-shlib I did that with R 2.2.1 and can build without problem. Any suggestion on how to link to libR.so in later R versions? Your help is very appreciated. Best regards, Jiangtian __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel