[R] Building and loading a DLL on Windows NT

Benjamin.STABLER@odot.state.or.us Benjamin.STABLER at odot.state.or.us
Wed Sep 17 22:51:31 CEST 2003


I am trying to build a simple dll with Rcmd SHLIB to link into R.  The
results of the build are below.  From my limited knowledge of building DLLs,
it looks like it worked (I didn't get any errors).

F:\R\dlls> Rcmd SHLIB add.C
making add.d from add.C
g++   -IC:/PROGRA~1/R/src/include -Wall -O2   -c add.C -o add.o
ar cr add.a *.o
ranlib add.a
g++  --shared -s  -o add.dll add.def add.a  -LC:/PROGRA~1/R/src/gnuwin32
-lg2c -lR

Then I tried to load the DLL into R with:

dyn.load("F:\\R\\dlls\\add.dll")

which returned nothing (which I assumes means there were no errors).  But,

> is.loaded(symbol.C("add"))
[1] FALSE

returns false.  add is the name of the function in the source file.  I know
I can dynamically load other DLLs.  I've read quite a bit of documentation
and I am still stumped.  I have all the proper tools for building R under
Windows and I know they work since I have built Windows package binaries.
Any ideas on what I am doing wrong would be greatly appreciated.  Thanks.

Ben Stabler




More information about the R-help mailing list