Skip to content
Prev 6551 / 15075 Next

How to link shared objects?

Dear list


I try to link some own C code of my package with a shared object of an  
other R-package. In "Writing R Extensions"  it's written that  it is ,  
in general, not possible to link a shared object of packageA with  
packageB followed by some hints how to do it  anyway. The manual  
propose the following code for linking during installation of packageA

PKGB_PATH=?echo ?library(packB); cat(system.file("libs",  
package="packB"))? \
| R --vanilla --slave?
PKG_LIBS=-L"$(PKGB_PATH)" -lpackB.

As I'm not so familiar with C where do I have to put this Code? I  
tried it with a Makevars file without
success.

I think it should be possible to link shared objects between different  
packages. I would be appreciate for
any hints in this topic.


Regards

Christoph Hofer



ETH Zurich
Christoph Hofer
Soil and Terrestrial Environmental Physics
Institute of Terrestrial Ecosystems
CHN E 50.2
Universit?tstrasse 16
8092 Zurich, Switzerland
phone         (+41) - (0)44 - 633 63 65
fax               (+41) - (0)44 - 633 11 23
e-mail: christoph.hofer at env.ethz.ch