[Rd] linking to R.dll on Win32 - issues with recent MinGW?

Duncan Murdoch dmurdoch at pair.com
Fri Oct 24 01:02:03 MEST 2003


On Thu, 23 Oct 2003 14:21:08 +0200, you wrote:

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

I can help with one of them, but not the main one.


>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?

This looks like what I see every time I run R under gdb.  The problem
is a bug/incompatibility in the MinGW run-time library.  R has its own
malloc, and some functions in the startup code expect the standard
MSVCRT malloc to be called, and it's not.  Within the debugger the
error is harmless, except for wasting some time.  I don't see the
later crash at a different location, but it sounds like a similar
symptom.

The workaround the MinGW folks told me was to rename the R malloc to
something else (e.g. by a define in Defn.h).  However, I got this
advice too close to the 1.8.0 release date to want to risk it.  I'll
try it for 1.9, not 1.8.1.

Duncan Murdoch


>
>All the above was tested with MinGW-3.1.
>Any ideas? Is that a MinGW bug or something I did? ;)
>
>Thanks.
>Simon
>
>---
>Simon Urbanek
>Department of computer oriented statistics and data analysis
>University of Augsburg
>Universitätsstr. 14
>86135 Augsburg
>Germany
>
>Tel: +49-821-598-2236
>Fax: +49-821-598-2200
>
>Simon.Urbanek at Math.Uni-Augsburg.de
>http://simon.urbanek.info
>
>______________________________________________
>R-devel at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list