Hi All, I have already used gcc to creat a library, for example, it is called "test.a", which includes many c objects. How to link my main "a.c" function to this library when I used Rcmd SHLIB to complier my main c program? I tried "Rcmd SHLIB a.c test.a". It does not work this way. Does anyone have idea about this? Thanks, Xiaoping -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
link my own C library using Rcmd SHLIB
4 messages · Xiaoping Jin, Brian Ripley
On Fri, 23 Aug 2002, Xiaoping Jin wrote:
Hi All, I have already used gcc to creat a library, for example, it is called "test.a", which includes many c objects. How to link my main "a.c" function to this library when I used Rcmd SHLIB to complier my main c program? I tried "Rcmd SHLIB a.c test.a". It does not work this way. Does anyone have idea about this?
Set PKG_LIBS in a file Makevars.win just as you would do when setting up the sources for an R package (which I think would be the preferred way to do this).
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi Dr Ripley, Thank you for your email! Since I am a beginner on R, Could you tell me a little more, if you have time? First, where I can find makevar.win? I only saw "makefile" in my PC. Second, how to set PKG_LIBS in that file? I have read manaul agian, if I did something in this file, I can use -l or -L flags to pass linker, am I right? By the way, I have read your splus book, there you mentioned gnu complier. I can use gcc, dllwrap tool. Can I do this way? Now I am trying to firgure those out. I have some own package ( .a file), and I want to use them when I use .C function. Thanks, Xiaoping
On Sat, 24 Aug 2002 ripley at stats.ox.ac.uk wrote:
On Fri, 23 Aug 2002, Xiaoping Jin wrote:
Hi All, I have already used gcc to creat a library, for example, it is called "test.a", which includes many c objects. How to link my main "a.c" function to this library when I used Rcmd SHLIB to complier my main c program? I tried "Rcmd SHLIB a.c test.a". It does not work this way. Does anyone have idea about this?
Set PKG_LIBS in a file Makevars.win just as you would do when setting up the sources for an R package (which I think would be the preferred way to do this). -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sat, 24 Aug 2002, Xiaoping Jin wrote:
Hi Dr Ripley, Thank you for your email! Since I am a beginner on R, Could you tell me a little more, if you have time? First, where I can find makevar.win? I only saw "makefile" in my PC.
You create Makevars.win. See some of the packages for examples.
Second, how to set PKG_LIBS in that file? I have read manaul agian, if I did something in this file, I can use -l or -L flags to pass linker, am I right?
Yes.
By the way, I have read your splus book, there you mentioned gnu complier. I can use gcc, dllwrap tool. Can I do this way?
Yes, but gcc -shared -o foo.so *,o test.a is better.
Now I am trying to firgure those out. I have some own package ( .a file), and I want to use them when I use .C function. Thanks, Xiaoping On Sat, 24 Aug 2002 ripley at stats.ox.ac.uk wrote:
On Fri, 23 Aug 2002, Xiaoping Jin wrote:
Hi All, I have already used gcc to creat a library, for example, it is called "test.a", which includes many c objects. How to link my main "a.c" function to this library when I used Rcmd SHLIB to complier my main c program? I tried "Rcmd SHLIB a.c test.a". It does not work this way. Does anyone have idea about this?
Set PKG_LIBS in a file Makevars.win just as you would do when setting up the sources for an R package (which I think would be the preferred way to do this). -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._