From Matthew.Redding at dpi.qld.gov.au  Wed Sep 17 05:04:29 2008
From: Matthew.Redding at dpi.qld.gov.au (Redding, Matthew)
Date: Wed, 17 Sep 2008 13:04:29 +1000
Subject: [Rd] odesolve dynload example
References: <OF239F5926.810942CD-ON852574C6.004405AE-852574C6.004479B7@epamail.epa.gov>
Message-ID: <200809170304.m8H34TtO031179@dpi-gw1.dpi.qld.gov.au>

Hi Woodrow, Peter and others.

Getting rid of those excess files smoothed the process a little:

Rcmd SHLIB mymod.c
C:\Program Files\R\R-2.7.2\library\odesolve\dynload\c>Rcmd SHLIB mymod.c
gcc  -std=gnu99  -IC:/PROGRA~1/R/R-27~1.2/include     -O3 -Wall  -c mymod.c -o mymod.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

This completed without returning an error.

The problem now is that it did not produce a "mymod.so" in the folder, only a mymod.o.

so the dyn.load() command in the example R program has nothing to work with..

Any ideas?

Kind regards, 

Matt Redding

-----Original Message-----
From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-project.org] On Behalf Of Setzer.Woodrow at epamail.epa.gov
Sent: Tuesday, 16 September 2008 10:28 PM
To: Peter Dalgaard
Cc: Redding, Matthew; r-devel at r-project.org
Subject: Re: [Rd] odesolve dynload example

I'm the maintainer of odesolve.  In the ...odesolve/dynload/c directory of the windows distribution are two files that should not be: mymod.o and mymod.so (I just noticed them).  Try deleting  them and rerunning your compilation.

By the way, you might want to take a look at deSolve, which supercedes odesolve.  deSolve includes lsoda with the same API as in odesolve, but also includes several other ode solvers you might find useful.  In the next several months, odesolve will be deprecated.

R. Woodrow Setzer, Ph. D.
National Center for Computational Toxicology http://www.epa.gov/comptox US Environmental Protection Agency Mail Drop B205-01/US EPA/RTP, NC 27711
Ph: (919) 541-0128    Fax: (919) 541-1194


                                                                        
             Peter Dalgaard                                             
             <p.dalgaard at bios                                           
             tat.ku.dk>                                              To 
             Sent by:                 "Redding, Matthew"                
             r-devel-bounces@         <Matthew.Redding at dpi.qld.gov.au>  
             r-project.org                                           cc 
                                      r-devel at r-project.org             
                                                                Subject 
             09/16/2008 01:59         Re: [Rd] odesolve dynload example 
             AM                                                         
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        




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

______________________________________________
R-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
R-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

********************************DISCLAIMER****************************=...{{dropped:12}}



[Rd] odesolve dynload example
Redding, Matthew