R-beta: .C and dyn.load for Windows

Peter Dalgaard BSA p.dalgaard at kubism.ku.dk
Mon Aug 18 15:03:37 CEST 1997

Goran Brostrom <gb at pc30.stat.umu.se> writes:

> Dear R-users,
> I maintain software for survival analysis written in C and Fortran since
> many years ago. Recently I have rewritten part of it as functions to
> be called from R by .C. This works fine with the unix version. I just
> create a ".so" file as described in an example in the R distribution.
> However, when I try this approach in Windows (NT or 95), using the 
> Cygnus gcc latest version, the "ld" command to create the ".so" file fails
> miserably. The Windows R documentation talks about "DLL"s, of which I
> know very little.
> Can anyone tell me how to create R-loadable C-code with Cygnus gcc under
> Windows (NT, 95)?
> Maybe it isn't possible?

(This really is alpha/development  stuff, belonging on r-devel)

Is this the Cygnus gcc from gnuwin32? You're a very brave person..!
You didn't happen to get the Windows GUI stuff going while you were at
it, did you?

Robert Gentleman says that he has DLL loading "near the top of his
list" for the next Windows binary version.

Another pointer is that it is rumored that *scilab* has some code to
do the trick on the windows platforms

Some nice guy on the gnuwin32 list claimed to have compatibility
functions for the whole dlopen/dlsym/.. slew a few weeks ago.

BTW: You do know that there already is a quite comprehensive survival
package for R?

Here is the note from gnuwin32:

Dear all,

I have made some work to let dlls have almost the same behavior as so on UNIX:

        - implementation of dlopen,dlclose,dlsym,dlerror
        - correct init when loaded + call of global contructors
        - call of global destructors when detached
        - dlls are accessible and correctly initialized in forked process
        - handles got through dlopen or dlsym in parent are accessible in child
        - use of LD_LIBRARY_PATH in dlopen search

I think it can help people who need an intensive use of dll ( plugins ... )

My patch is 59082 bytes, so I will not send it to the list.
Anyway, if you are interested, send me a mail and I will send you the patch
personnaly ...


P.S: I will send the patch to Geoffrey Noer

|                         Philippe GIACINTI                                |
|                                                                          |
| DALiM GmbH R&D                                email:  giac at dalim.de      |
| Daimler Strasse 2,                            tel:    +49.7851.9196-28   |
| D-77694 Kehl-Sundheim Germany                 fax:    +49.7851.73576     |
|                                                                          |

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
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