Skip to content

link my own C library using Rcmd SHLIB

4 messages · Xiaoping Jin, Brian Ripley

#
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Fri, 23 Aug 2002, Xiaoping Jin wrote:

            
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).
#
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:

            
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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:

            
You create Makevars.win.  See some of the packages for examples.
Yes.
Yes, but gcc -shared -o foo.so *,o test.a  is better.