[R] where is Defn.h and implementation

jiesheng zhang jiesheng at bioteam.net
Sun Oct 16 14:18:43 CEST 2005


Hi, all

I am in the process of writing my first R extesion package.

One of my function uses StrToInternal function(I copy it from other 
extension package). I noticed the StrToInternal was defined in "Defn.h". 
I have two questions:
1)should "Defn.h"  be under $R_HOME/include. I could not find it in any 
file under $R_HOME/include.
2)Where is the implementation for the functions defined in the "Defn.h"? 
Where dynamic library should I link to for the StrToInternal implementation?

When I load my extension and library, I got this error
-------------------------------
 > library("btRRTest")
Error in dyn.load(x, as.logical(local), as.logical(now)) :
         unable to load shared library 
'/common/apps/lib/R/library/btRRTest/libs/btRRTest.so':
   /common/apps/lib/R/library/btRRTest/libs/btRRTest.so: undefined 
symbol: StrToInternal
Error in library("btRRTest") : .First.lib failed for 'btRRTest'
--------------------------------

My package is compiled during installation like this
--------------------------------
jasonportal:/home/jason/tmp2 # R CMD INSTALL btRRTest
* Installing *source* package 'btRRTest' ...
** libs
gcc -I/common/apps/lib/R/include  -I/usr/local/include   -fPIC  -g -O2 
-c btRRtest.c -o btRRtest.o
gcc -I/common/apps/lib/R/include  -I/usr/local/include   -fPIC  -g -O2 
-c client.c -o client.o
gcc -I/common/apps/lib/R/include  -I/usr/local/include   -fPIC  -g -O2 
-c pack.c -o pack.o
gcc -I/common/apps/lib/R/include  -I/usr/local/include   -fPIC  -g -O2 
-c rpack.c -o rpack.o
rpack.c: In function `my_remove':
rpack.c:23: warning: assignment makes pointer from integer without a cast
rpack.c: In function `CreateDataPacket':
rpack.c:156: warning: assignment makes pointer from integer without a cast
rpack.c: In function `convertDataPacketToVariable':
rpack.c:229: warning: assignment makes pointer from integer without a cast
rpack.c: In function `setDataPacketToEnv':
rpack.c:256: warning: assignment makes pointer from integer without a cast
gcc -I/common/apps/lib/R/include  -I/usr/local/include   -fPIC  -g -O2 
-c util.c -o util.o
gcc -I/common/apps/lib/R/include  -I/usr/local/include   -fPIC  -g -O2 
-c worker.c -o worker.o
gcc -shared -L/usr/local/lib -o btRRTest.so btRRtest.o client.o pack.o 
rpack.o util.o worker.o
** R
No man pages found in package 'btRRTest'
** building package indices ...
* DONE (btRRTest)
--------------------------------

Help is appreciated.

-jason




More information about the R-help mailing list