[R] Rcmd SHLIB in rw1031 (R for Win)

Agustin Lobo alobo at ija.csic.es
Thu Oct 18 19:30:37 CEST 2001


Thanks for the answers on readme.packages.

I have installed Rw1031 from SetupR.exe including the option
for compiling source files and, following directions in 
www.stats.ox.ac.ul/pub/Rtools, have installed:

-tools.zip
-Perl (Active Perl)
-mingw-1.1.tar.gz
-copied sh.exe to c:\bin\sh.exe

After Perl installation, its directory is added to my path. I have also
added the directory where the R tools live, as well as the bin for
mingw.

My path looks like:


PATH=E:\PERL\BIN;E:\RW1031\RWINT;E:\RW1031\RWINT\BIN;C:\WINDOWS;C:\WINDOWS\COMMAND;C:\DOS;D:\;C:\UTILES\ULTRAEDT;C:\GZIP;C:\PROGRA~1\PATHFI~1.70;


Then I've tried to compile and build a dll for a C program (test.c)
that works fine in the R version for Linux.

I do:  



E:\rw1031\bin>Rcmd SHLIB e:/Rseg/test.c
make[1]: `libR.a' is up to date.
------- Building e:/Rseg/test.dll from e:/Rseg/test.a --------
echo LIBRARY e:/Rseg/test > e:/Rseg/test.def
echo EXPORTS >> e:/Rseg/test.def
nm e:/Rseg/test.a > Defs
sed -n '/^........ [BCDRT] _/s/^........ [BCDRT] _/ /p' Defs >>
e:/Rseg/test.def

rm -f Defs
gcc  --shared -s  -o e:/Rseg/test.dll e:/Rseg/test.def e:/Rseg/test.a
-LE:/RW10
31/src/gnuwin32  -lg2c -lR

E:\rw1031\bin>Rcmd SHLIB e:/Rseg/test.c
dlltool -k --as as   --dllname R.dll --def R.exp --output-lib libR.a
gcc   -IE:/RW1031/src/include -include E:/RW1031/src/include/globalvar.h
-Wall
-O2   -c e:/Rseg/test.c -o e:/Rseg/test.o
e:/Rseg/test.c:78: warning: `/*' within comment
e:/Rseg/test.c: In function `printListElement':
e:/Rseg/test.c:15: warning: unused variable `prova2'
e:/Rseg/test.c:15: warning: unused variable `prova'
e:/Rseg/test.c:14: warning: unused variable `s3'
e:/Rseg/test.c:14: warning: unused variable `s2'
e:/Rseg/test.c:14: warning: unused variable `s1'
e:/Rseg/test.c:14: warning: unused variable `g3'
e:/Rseg/test.c:14: warning: unused variable `g2'
e:/Rseg/test.c:14: warning: unused variable `g1'
e:/Rseg/test.c:9: warning: unused variable `names'
rm -f -f e:/Rseg/test.a
ar cr e:/Rseg/test.a *.o
e:\RW1031\RWINT\BIN\ar.exe: *.o: No such file or directory
make: *** [e:/Rseg/test.a] Error 1



I've checked, and ar.exe is in e:\RW1031\RWINT\BIN
...and test.a in e:/Rseg/


If I repeat, the process starts from test.a:

E:\rw1031\bin>Rcmd SHLIB e:/Rseg/test.c
make[1]: `libR.a' is up to date.
------- Building e:/Rseg/test.dll from e:/Rseg/test.a --------
echo LIBRARY e:/Rseg/test > e:/Rseg/test.def
echo EXPORTS >> e:/Rseg/test.def
nm e:/Rseg/test.a > Defs
sed -n '/^........ [BCDRT] _/s/^........ [BCDRT] _/ /p' Defs >>
e:/Rseg/test.def

rm -f Defs
gcc  --shared -s  -o e:/Rseg/test.dll e:/Rseg/test.def e:/Rseg/test.a
-LE:/RW10
31/src/gnuwin32  -lg2c -lR


Apparentely, all good. But, from R:

> dyn.load("test.dll")
> a <- segmentaF2001.new3(test5.stat,test5.ady)
ITERACION: 1Error in .Call("printListElement", lista, t(stat), ncol(stat),
nrow(stat)) : 
        .Call function name not in load table
Timing stopped at: NA NA 0.11 NA NA 
> 


The same code works fine under Linux. 

Does anyone see where is the problem?

Thanks

Agus

Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es



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



More information about the R-help mailing list