[R] Link with C code (compiled code under Windows)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Jan 30 17:00:33 CET 2001
> From: "Patrick Wendel" <p.wendel at ic.ac.uk>
> Date: Tue, 30 Jan 2001 13:05:23 -0000
>
>
> I am using cygwin (latest version) and I managed to generate a dll partly
> with rcmd shlib although there was a problem with both the resouce file (I
Rcmd SHLIB, perhaps?
> had to remove "FILEOS VOS__WINDOWS32") and the command line for gcc
> (--shared is not supported for instance).
As all recent cygwins have supported --shared, I don't know what to say.
Set up correctly, it works out of the box, although there are warnings
in the documentation that it is not a preferred route.
Also HAVE_SHARED is a documented flag. You did notice that as you
edited MkRules, didn't you?
> So I would like to know which compiler/environment you advise to use for
> windows OS.
That is clearly documented in the sources and rw1021sp.zip, in files
INSTALL and readme.packages, for example.
> Then I could load the library in R but couldn't call any method.
>
> Is there a function to know which functions have been successfully imported
> ?
None. DLLs don't work like that: they are probed for symbols as needed.
You can use pedump to explore whether the symbols are exported correctly.
> I've also done the dll in other ways (using gcc and dlltool as explained on
> their website and also using VC++) but I had the same result.
May be it is not the DLL. Maybe it is your C code or what you are
trying to do with it?
> I suppose I missed something in the dll creation but I cannot see what.
>
> Any idea ?
Try
(1) reading the R documentation
(2) making a simple example (e.g. package windlgs) to see if your
compiler system is working.
BDR
BTW, Rcmd SHLIB in 1.2.1 using some make.exe's fails. Change SOURCES in
bin/SHLIB and src/gnuwin32/MakeDll to CFSOURCES to avoid this.
(Some make.exe's pass down macros, some do not .... It worked with the
make I first used, but not the latest one.)
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list