From p.dalgaard at biostat.ku.dk  Tue Sep 16 07:59:48 2008
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Tue, 16 Sep 2008 07:59:48 +0200
Subject: [Rd] odesolve dynload example
In-Reply-To: <200809160010.m8G0AGNj088618@dpi-gw1.dpi.qld.gov.au>
References: <200809160010.m8G0AGNj088618@dpi-gw1.dpi.qld.gov.au>
Message-ID: <48CF4B54.7010305@biostat.ku.dk>

Redding, Matthew wrote:
> Hello R Developers,
>
> This is my first foray into using c-code with R, so please forgive my
> foolishness.
> I had a look at the archives and did not find anything on this, so
> hopefully I am not doubling up.
>
> I have tried to use R cmd to create an object file from the odesolve
> dynload example.
> I am using windows and have just installed rtools, and have the latest
> version of stable R (2..7.2).
>
> This is what happened:
>
> C:\Program Files\R\R-2.7.2\library\odesolve\dynload\c>Rcmd SHLIB mymod.c
> making mymod.d from mymod.c
> windres --preprocessor="gcc -E -xc -DRC_INVOKED" -I
> C:/PROGRA~1/R/R-27~1.2/include  -i mymod_res.rc -o mymod_res.o
> gcc  -std=gnu99  -shared -s  -o mymod.dll mymod.def mymod.o mymod_res.o
> -LC:/PROGRA~1/R/R-27~1.2/bin    -lR
> Cannot export myderivs: symbol not found
> Cannot export myjac: symbol not found
> Cannot export mymod: symbol not found
> mymod.o: In function `mymod':
> /home/setzer/tasks/Programming_Projects/odesolve/odesolve/inst/dynload/c
> /mymod.c:14: undefined reference to `GLOBAL_OFFSET_TA
> BLE_'
> mymod.o: In function `myderivs':
> /home/setzer/tasks/Programming_Projects/odesolve/odesolve/inst/dynload/c
> /mymod.c:21: undefined reference to `GLOBAL_OFFSET_TA
> BLE_'
> mymod.o: In function `myjac':
> /home/setzer/tasks/Programming_Projects/odesolve/odesolve/inst/dynload/c
> /mymod.c:30: undefined reference to `GLOBAL_OFFSET_TA
> BLE_'
> collect2: ld returned 1 exit status
> make: *** [mymod.dll] Error 1
>
> Any ideas what I have not got set up properly? What do I need to do to
> get this firing? 
> Advice appreciated.
>   
I'm a bit rusty on the windows tools, but it looks like mymod.o and  
mymod_res.rc  not being made above. Any chance that you have old 
versions lying around?

-- 
   O__  ---- Peter Dalgaard             ?ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



[Rd] odesolve dynload example
Peter Dalgaard