[R] Porting from Linux to Windows

A.J. Rossini blindglobe at gmail.com
Fri Jan 14 12:39:44 CET 2005


Don't mix R and Cygwin, at least not this year.

Peter's advice is spot on, for the rest.

best,
-tony



On Fri, 14 Jan 2005 10:51:19 +0100 (CET), commercial at s-boehringer.de
<commercial at s-boehringer.de> wrote:
> I intend to port an R project from Linux to Windows.
> It involves C code that is loaded via dyn.load().
> I could manage to produce a 'dll' File using cygwin which seems to be
> o.k.
> 
> Now, using dyn.load("pcr.dll") i get:
> 
> Error in dyn.load(x, as.logical(local), as.logical(now)) :
>        unable to load shared library
> "c:/cygwin/home/pingu/rt-pcr/pcr.dll":
>  LoadLibrary failure:  Invalid access to memory location.
> 
> Besides modifying the makefile no changes have been made to the source
> code. This is the Makefile (the relevant target is winlib):
> ---
> RHOME="C:/Program Files/R/rw1090"
> 
> SOURCE=lambert.c
> OBJ=lambert.o brent.o nrutil.o pcr.o
> #CFLAGS=-I/usr/lib/R/include -g -O2
> CFLAGS+=-I${RHOME}/src/include -mno-cygwin
> CFLAGS+=-I/usr/lib/R/include -g -O2
> OBJT=${OBJ} test.o
> OBJR=${OBJ} pcr-R.o
> 
> ${OBJ} : ${SOURCE}
> #       cc -I/usr/lib/R/include -o $@.o $@.c
> 
> test : test.o ${OBJ}
>        cc -g -o test ${OBJT} -lc -lm
> 
> lib : ${OBJR}
>        cc -o pcr.so ${OBJR} -lc -lm -shared
> 
> # we may not use ld because the -mno-cygwin cannot be passed
> # which is required
> winlib : ${OBJR}
>        cc -mno-cygwin  -o pcr.dll ${OBJR} ${RHOME}/bin/R.dll -lc -lm -shared
> ---
> 
> Does anybody have some clue? I am using gcc v3.3.3 and R1.9.0 on
> Windows. If there is a recipe somewhere that I have missed I would be
> most grateful.
> 
> Thank you very much,
> 
>        Stefan
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 


-- 
best,
-tony

"Commit early,commit often, and commit in a repository from which we can easily
roll-back your mistakes" (AJR, 4Jan05).

A.J. Rossini
blindglobe at gmail.com




More information about the R-help mailing list