From wdunlap at tibco.com  Thu Feb 16 02:26:58 2012
From: wdunlap at tibco.com (William Dunlap)
Date: Thu, 16 Feb 2012 01:26:58 +0000
Subject: [Rd] R CMD SHLIB in Windows XP - No output at all
In-Reply-To: <1329350587496-4392482.post@n4.nabble.com>
References: <1329178163008-4385797.post@n4.nabble.com>
	<4F3BD2E0.8070602@gmail.com> <1329350587496-4392482.post@n4.nabble.com>
Message-ID: <E66794E69CFDE04D9A70842786030B9327B563@PA-MBX04.na.tibco.com>

Does the following example help?  I installed Duncan Murdoch's
Rtools-2.13 into E:\Rtools-2.13 and R into E:\Program Files\R\R-2.14.1.
I put a small file of C code into E:\temp\junk.c.  Here is record
of what I did after opening a new cmd.exe window.  Setting PATH
is critical: put the 2 bin directories under Rtools first in PATH.
You might want R_HOME\bin early too, if you already have some other R_HOME
directory in your standard PATH.

C:\Documents and Settings\wdunlap>set PATH=e:\Rtools-2.13\bin;e:\Rtools-2.13\MinGW\bin;%PATH%;e:\Program Files\R\R-2.14.1\bin

C:\Documents and Settings\wdunlap>e:

E:\>cd \temp

E:\temp>R CMD SHLIB -o junk.dll junk.c
cygwin warning:
  MS-DOS style path detected: E:/PROGRA~1/R/R-214~1.0/etc/i386/Makeconf
  Preferred POSIX equivalent is: /cygdrive/e/PROGRA~1/R/R-214~1.0/etc/i386/Makeconf
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
gcc  -I"E:/PROGRA~1/R/R-214~1.0/include"     -I"d:/RCompile/CRANpkg/extralibs/local/include"     -O3 -Wall  -std=gnu99 -mtune=core2 -c junk.c -o junk.
o
gcc -shared -s -static-libgcc -o junk.dll tmp.def junk.o -Ld:/RCompile/CRANpkg/extralibs/local/lib -LE:/PROGRA~1/R/R-214~1.0/bin/i386 -lR

E:\temp>type junk.c
void my_junk(double *x)
{
    *x = *x + 100.0;
}

E:\temp>R
... [elided startup messages] ...
> dyn.load("junk.dll")
> .C("my_junk", pi) # expect to get 100+3.14159265...
[[1]]
[1] 103.1416

>

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 
> -----Original Message-----
> From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-project.org] On Behalf Of Lorenzo
> Sent: Wednesday, February 15, 2012 4:03 PM
> To: r-devel at r-project.org
> Subject: Re: [Rd] R CMD SHLIB in Windows XP - No output at all
> 
> Hi Duncan,
> 
> Thanks for your help, I am actually using R Windows version 2.14.1 (22th Dec
> 2011).
> 
> Actually by "R CMD SHLIB *.*" I actually meant putting any file name after
> the R CMD SHLIB ("R CMD SHLIB convolve.c" for example).
> Another case which fails is : creating a Rcpp Armadillo package skeleton
> (named MyPackage for example) and trying the R CMD INSTALL MyPackage. Fails
> as well on the R CMD SHLIB line.
> 
> What I actually don't understand is how the R CMD SHLIB command links to the
> RTools cygwin and mingw.
> It really looks like the "make" function works in my command line when I use
> it directly but the link between R CMD SHLIB and cygwin fails...
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/R-CMD-SHLIB-in-Windows-XP-No-output-at-
> all-tp4385797p4392482.html
> Sent from the R devel mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] R CMD SHLIB in Windows XP - No output at all
William Dunlap