Re: [Rd] odesolve dynload example

2008-09-16 Thread Peter Dalgaard

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\cRcmd 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
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


[Rd] WRONG mailing list - Re: question in value-based color in image()

2008-09-16 Thread Martin Maechler
Please do use R-help, (not R-devel)
for such questions.

 M == M  [EMAIL PROTECTED]
 on Mon, 15 Sep 2008 22:42:22 -0400 writes:

M Hello, I have a matrix with value varying from -1 to 1.
M I hope to use scaled color based on its value to produce
M an image of this matrix.

M Suppose I hope to label those data in [-1,-0.5] with
M blue, label those [-0.5,0.8] with light blue (tone is
M proportional to its value) and label those [0.8,1] with
M white.

M How can I use image() and rgb() to achieve this?  It
M would be great if I can have a color scale legend, too.

M TIA, Chris

M  [[alternative HTML version deleted]]

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


Re: [Rd] question in value-based color in image()

2008-09-16 Thread Uwe Ligges



M. wrote:

Hello,

I have a matrix with value varying from -1 to 1.  I hope to use scaled color
based on its value to produce an image of this matrix.

Suppose I hope to label those data in [-1,-0.5] with blue, label those
[-0.5,0.8] with light blue (tone is proportional to its value) and label
those [0.8,1] with white.

How can I use image() and rgb() to achieve this?  It would be great if I can
have a color scale legend, too.



1. This is a message for R-help (if at all), definitely not for R-devel!
2. Have you read ?image ?

Anyway, example:

image(matrix(c(-1, -0.6, -0.4, 1), ncol = 2),
  breaks = c(-1, -0.5, 0.8, 1),
  col = c(blue, lightblue, white))

Uwe Ligges





TIA,
Chris

[[alternative HTML version deleted]]

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


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


[Rd] aggregate() does not return POSIXct object correctly (PR#12887)

2008-09-16 Thread rene . locher
Full_Name: Rene Locher
Version: 2.7.2 Patched (2008-09-12 r46541)
OS: XP
Submission from: (NULL) (160.85.231.40)


dat - data.frame(event=factor(c(A,A,B)),
  time=as.POSIXct(c(2008-01-10,2008-01-01,2008-01-04)))

min(dat$time)
## 2008-01-01 CET
## as expected

aggregate(dat$time,by=list(event=dat$event),min)
## results in
##event  x
##  1 A 1199142000
##  2 B 1199401200

## I expected:
##eventx
##  1 A 2008-01-01 CET
##  2 B 2008-01-04 CET

## my system:

sessionInfo()
## R version 2.7.2 Patched (2008-09-12 r46541)
## i386-pc-mingw32
##
## locale:
## 
LC_COLLATE=German_Switzerland.1252;LC_CTYPE=German_Switzerland.1252;LC_MONETARY=German_Switzerland.1252;LC_NUMERIC=C;LC_TIME=German_Switzerland.1252
##
## attached base packages:
## [1] stats graphics  grDevices utils datasets  methods   base

Kind regards

Rene Locher E-Mail: [EMAIL PROTECTED]
Institute for Data Analysis and Process Design Tel:+41 58 934 7810
Zurich University of Applied Sciences  Fax:+41 58 935 7810
Rosenstrasse 3   
Postfach
CH-8401 Winterthurhttp://www.idp.zhaw.ch

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


Re: [Rd] aggregate() does not return POSIXct object correctly (PR#12887)

2008-09-16 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote:
 Full_Name: Rene Locher
 Version: 2.7.2 Patched (2008-09-12 r46541)
 OS: XP
 Submission from: (NULL) (160.85.231.40)


 dat - data.frame(event=factor(c(A,A,B)),
   time=as.POSIXct(c(2008-01-10,2008-01-01,2008-01-04)))

 min(dat$time)
 ## 2008-01-01 CET
 ## as expected

 aggregate(dat$time,by=list(event=dat$event),min)
 ## results in
 ##event  x
 ##  1 A 1199142000
 ##  2 B 1199401200

 ## I expected:
 ##eventx
 ##  1 A 2008-01-01 CET
 ##  2 B 2008-01-04 CET
   

This is as documented, possibly annoying, but not a bug.

aggregate() is documented to build on tapply() for which the discarding
of class is documented on ?tapply. The root cause is unlist():

 tapply(dat[[time]],dat$event,min,simplify=FALSE)
$A
[1] 2008-01-01 CET

$B
[1] 2008-01-04 CET

 unlist(tapply(dat[[time]],dat$event,min,simplify=FALSE))
 A  B
1199142000 1199401200

and a partial rationale is that unlist() wouldn't know what to do if the
arguments had different classes.
The workaround is, of course, just to stick the class back on.




-- 
   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
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


Re: [Rd] aggregate() does not return POSIXct object correctly (PR#12887)

2008-09-16 Thread Gabor Grothendieck
On Tue, Sep 16, 2008 at 11:22 AM, Peter Dalgaard
[EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
 Full_Name: Rene Locher
 Version: 2.7.2 Patched (2008-09-12 r46541)
 OS: XP
 Submission from: (NULL) (160.85.231.40)


 dat - data.frame(event=factor(c(A,A,B)),
   time=as.POSIXct(c(2008-01-10,2008-01-01,2008-01-04)))

 min(dat$time)
 ## 2008-01-01 CET
 ## as expected

 aggregate(dat$time,by=list(event=dat$event),min)
 ## results in
 ##event  x
 ##  1 A 1199142000
 ##  2 B 1199401200

 ## I expected:
 ##eventx
 ##  1 A 2008-01-01 CET
 ##  2 B 2008-01-04 CET


 This is as documented, possibly annoying, but not a bug.

 aggregate() is documented to build on tapply() for which the discarding
 of class is documented on ?tapply. The root cause is unlist():

 tapply(dat[[time]],dat$event,min,simplify=FALSE)
 $A
 [1] 2008-01-01 CET

 $B
 [1] 2008-01-04 CET

 unlist(tapply(dat[[time]],dat$event,min,simplify=FALSE))
 A  B
 1199142000 1199401200

 and a partial rationale is that unlist() wouldn't know what to do if the
 arguments had different classes.
 The workaround is, of course, just to stick the class back on.


Another workaround is:

https://stat.ethz.ch/pipermail/r-help/2008-September/173139.html

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


Re: [Rd] odesolve dynload example

2008-09-16 Thread Thomas Petzoldt

Hi Matthew,

thank you for the bug report, Woodrow Setzer just uploaded a minor 
bugfix and I assume he informed you off-list.


One additional note for the records:

We suggest odesolve users should switch over to the new deSolve package. 
It is maintained by the the same (and two additional) authors like 
odesolve. It is almost ;-) fully compatible to odesolve and will replace 
it completely. The authors renamed it to deSolve, because it's able to 
solve also DAE and PDE systems, not only ODEs, so the name odesolve was 
too narrow and is now deprecated.


Note that deSolve has a package vignette about writing models in 
compiled code.


Thomas Petzoldt



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\cRcmd 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.


Kind regards, 


Matt Redding
DISCLAIMER**...{{dropped:15}}

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




--
Thomas Petzoldt
Technische Universitaet Dresden
Institut fuer Hydrobiologie[EMAIL PROTECTED]
01062 Dresden  http://tu-dresden.de/hydrobiologie/
GERMANY

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


Re: [Rd] odesolve dynload example

2008-09-16 Thread Setzer . Woodrow
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-0128Fax: (919) 541-1194



 Peter Dalgaard 
 [EMAIL PROTECTED]   
 tat.ku.dk  To 
 Sent by: Redding, Matthew
 r-devel-bounces@ [EMAIL PROTECTED]  
 r-project.org   cc 
  r-devel@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\cRcmd 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
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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

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


Re: [Rd] odesolve dynload example

2008-09-16 Thread Redding, Matthew
Thanks so much for the answer.

I will let you know how things go.

I will definitely look into desolve

Kind regards

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, 16 September 2008 10:28 PM
To: Peter Dalgaard
Cc: Redding, Matthew; r-devel@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-0128Fax: (919) 541-1194



 Peter Dalgaard 
 [EMAIL PROTECTED]   
 tat.ku.dk  To 
 Sent by: Redding, Matthew
 r-devel-bounces@ [EMAIL PROTECTED]  
 r-project.org   cc 
  r-devel@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\cRcmd 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
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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

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

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

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


Re: [Rd] odesolve dynload example

2008-09-16 Thread Redding, Matthew
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\cRcmd 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, 16 September 2008 10:28 PM
To: Peter Dalgaard
Cc: Redding, Matthew; r-devel@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-0128Fax: (919) 541-1194



 Peter Dalgaard 
 [EMAIL PROTECTED]   
 tat.ku.dk  To 
 Sent by: Redding, Matthew
 r-devel-bounces@ [EMAIL PROTECTED]  
 r-project.org   cc 
  r-devel@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\cRcmd 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
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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

__
R-devel@r-project.org 

Re: [Rd] odesolve dynload example

2008-09-16 Thread Redding, Matthew
Excuse me, my mistake.

Of course on windows the Rcmd SHLIB makes a DLL... not a .so file.

So with the modification to the R script, it now works beautifully!

Thanks to all for your patience.

Matt 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Redding, Matthew
Sent: Wednesday, 17 September 2008 1:04 PM
To: [EMAIL PROTECTED]; Peter Dalgaard
Cc: r-devel@r-project.org
Subject: Re: [Rd] odesolve dynload example

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\cRcmd 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, 16 September 2008 10:28 PM
To: Peter Dalgaard
Cc: Redding, Matthew; r-devel@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-0128Fax: (919) 541-1194



 Peter Dalgaard 
 [EMAIL PROTECTED]   
 tat.ku.dk  To 
 Sent by: Redding, Matthew
 r-devel-bounces@ [EMAIL PROTECTED]  
 r-project.org   cc 
  r-devel@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\cRcmd 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__