Skip to content
Prev 9255 / 398502 Next

Link with C code

On Tue, 30 Jan 2001, Richards, Tom wrote:

            
Actually, it is gcc 2.95.2-1, and the -1 is important.
(Don't know where you got that last line from, but not S Programming for
sure.)
You link against libR.a, not Rdll.lib.  The makefiles will do all this for
you, but you could just run (once) in src/gnuwin32

dlltool --dllname R.dll --def R.exp --output-lib libR.a

Then

gcc -O2 -c doit.c -ID:\Rw1021\src\include
<see below>
gcc --shared -o doit.dll doit.def doit.o -LD:/Rw1021/src/gnuwin32 -lR

You need to create doit.def.  The Makefiles use nm and sed, but

dlltool --export-all-symbols --output-def doit.def doit.o

should do it.

It really is easiest just to let the Makefiles take the strain or
exactly follow a proven recipe.