From jeff.hamann at forestinformatics.com  Tue Feb 17 21:53:35 2004
From: jeff.hamann at forestinformatics.com (Jeff D. Hamann)
Date: Tue Feb 17 21:54:28 2004
Subject: [Rd] 
	RCMD SHLIB == Couldn't reserve space for cygwin's heap, Win32 ?
Message-ID: <006301c3f598$1c7b1b90$0a00a8c0@rodan>

I've been trying to create/load/call a dll from R-1.8.1 on Windows without
much success. I've been able to at least load the library on FreeBSD
(1.8.1). I've been able to perform this before using DLL that weren't
created using RCMD SHLIB, but simply compiling under MS DevStudio.


C:\optflikam>rcmd shlib --output=optflikam.dll as47.f as197.f flikam.c
g77 -O2 -Wall   -c as47.f -o as47.o
as47.f: In subroutine `minim':
as47.f:829: warning:
        4  1X'RESIDUAL VARIANCE'/' TO OBTAIN THE COVARIANCE MATRIX.'/)
             ^
Missing comma in FORMAT statement at (^)
as47.f:634: warning: `savemn' might be used uninitialized in this function
as47.f: In subroutine `chola':
as47.f:1040: warning: `w' might be used uninitialized in this function
as47.f:1041: warning: `rsq' might be used uninitialized in this function
as47.f:1043: warning: `i' might be used uninitialized in this function
g77 -O2 -Wall   -c as197.f -o as197.o
gcc   -Ic:/PROGRA~1/r/rw1081/src/include -Wall -O2   -c flikam.c -o flikam.o
In file included from flikam.c:16:
flikam.h:10:1: warning: "__stdcall" redefined
<built-in>:61:1: warning: this is the location of the previous definition
flikam.h:169:8: warning: extra tokens at end of #endif directive
flikam.c: In function `mainard':
flikam.c:127: warning: implicit declaration of function `minim_'
flikam.c:209: warning: implicit declaration of function `nelmin_'
flikam.c: In function `minim_objfunc':
flikam.c:293: warning: implicit declaration of function `flikam_'
flikam.c: In function `testfunc':
flikam.c:424: warning: passing arg 1 of `Rf_length' from incompatible
pointer type
flikam.c:425: warning: passing arg 1 of `Rf_length' from incompatible
pointer type
flikam.c:426: warning: passing arg 1 of `Rf_length' from incompatible
pointer type
flikam.c:428: warning: passing arg 1 of `Rf_coerceVector' from incompatible
pointer type
flikam.c:428: warning: assignment from incompatible pointer type
flikam.c:428: warning: passing arg 1 of `Rf_protect' from incompatible
pointer type
flikam.c:429: warning: passing arg 1 of `Rf_coerceVector' from incompatible
pointer type
flikam.c:429: warning: assignment from incompatible pointer type
flikam.c:429: warning: passing arg 1 of `Rf_protect' from incompatible
pointer type
flikam.c:430: warning: passing arg 1 of `Rf_coerceVector' from incompatible
pointer type
flikam.c:430: warning: assignment from incompatible pointer type
flikam.c:430: warning: passing arg 1 of `Rf_protect' from incompatible
pointer type
flikam.c:432: warning: passing arg 1 of `REAL' from incompatible pointer
type
flikam.c:433: warning: passing arg 1 of `REAL' from incompatible pointer
type
flikam.c:434: warning: passing arg 1 of `REAL' from incompatible pointer
type
flikam.c:461: warning: control reaches end of non-void function
ar cr optflikam.a *.o
ranlib optflikam.a
gcc  --shared -s  -o optflikam.dll optflikam.def
ptflikam.a  -Lc:/PROGRA~1/r/rw1081/src/gnuwin32  -lg2c -lR

C:\optflikam>

 Then from R, I've tried to simply load the library and R crashes and I
can't load the DLL. I keep getting the following error:

> dyn.load( "optflikam.dll" )
      5 [main] ? 4012 init_cheap: Couldn't reserve space for cygwin's heap,
Win32 error 487
c:\program files\r\rw1081\bin\Rterm.exe (4012): *** AllocationBase 0x0,
BaseAddress 0x61670000, RegionSize 0x1050000, State 0x10000

I thought it might have something to do with the compiler, so I looked at
the version of cygwin's gcc:

C:\optflikam>gcc --version
gcc (GCC) 3.3.1 (cygming special)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Is this the problem and has anyone else run into this? I've never seen this
meesage before.

Jeff.

---
Jeff D. Hamann
Forest Informatics, Inc.
PO Box 1421
Corvallis, Oregon USA 97339-1421
(office) 541-754-1428
(cell) 541-740-5988
jeff.hamann@forestinformatics.com
www.forestinformatics.com


[Rd] RCMD SHLIB == Couldn't reserve space for cygwin's heap, Win32 ?
Jeff D. Hamann