[Rd] linking to R.dll on Win32 - issues with recent MinGW?
Simon.Urbanek at math.uni-augsburg.de
Thu Oct 23 14:21:08 MEST 2003
I encountered several strange issues when linking to R.dll on Windows
and I wonder if anyone of the Windows savvy-folks here had seen some of
the issues before and have some explanation.
My Rserve links to R dynamic library. That works perfectly on unix
boxes and worked fairly well with older MinGW and older R (<=1.7.1).
What I do in fact is that I specify
when linking. This produced valid exe which was linked to R.dll. In
fact you could compile everything with the regular binary distribution
of R, even without R sources (MinGW got all it needs directly from
Now with R-1.8.0 (which is presumably compiled with more recent MinGW)
and MinGW 3.1 this doesn't work anymore on certain Win32 platforms,
e.g. I got reports that on W2k Rserve bails out with "Can't load
R.dll". Further investigation reveals that the .exe tries to load "R"
file and not "R.dll". But if you copy R.dll to R then both R and R.dll
get loaded, since R loads Rblas.dll which loads (correctly) R.dll. Then
everything crashes (presumably the two dlls fight each other). XP seems
to have a fix for that (i.e. a request for "R" will in fact load
"R.dll"), but not W2k.
Did anyone see this or does anyone have an idea how to prevent this
(except for downgrading MinGW)?
Now, I thought I'll use libR.a from the R sources instead of using the
final R.dll, because that's what libR.a is for, right? The first
obstacle was that libR.a doesn't export R_Home which I need to set in
my init routine, but fortunately there is "exported-vars" for that
case. But after finally compiling everything, Rserve crashes. It
doesn't even get as far as main. What I get is this:
Warning: Invalid Address specified to RtlSizeHeap( 003F0000, 0146008 )
and later a crash somewhere deep in libwsock32 (the trace is rather
weird) ... I guess the problem is the heap, not wsock itself. Any idea
what that could be?
All the above was tested with MinGW-3.1.
Any ideas? Is that a MinGW bug or something I did? ;)
Department of computer oriented statistics and data analysis
University of Augsburg
Simon.Urbanek at Math.Uni-Augsburg.de
More information about the R-devel