[R] Porting from Linux to Windows

commercial@s-boehringer.de commercial at s-boehringer.de
Fri Jan 14 10:51:19 CET 2005


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




More information about the R-help mailing list