[R] Assistance with dll's to use with dyn.load

From: <christian.ritter_at_shell.com>
Date: Tue 11 Jul 2006 - 19:12:26 EST


After having browsed the documentation for a while without discovering what I am looking for, maybe one of you would know ...

What I want to do:
I have two fortran files MC.f and ESCA.f. In MC.f there is a call to a routine called lpost. This routine (lpost) is defined (among other things) in ESCA.f. Under linux, I can do the following:

        R CMD SHLIB MC.f
and

        R CMD SHLIB ESCA.f
followed by

	dyn.load("ESCA.so",local=FALSE)
	dyn.load("MC.so")

(see point LINUX for some more)

Under windows, trying to Rcmd SHLIB MC.f will either:

	also compile ESCA.f and then run dlltools with ESCA.o yielding one MC.dll (if ESCA.f is in the same directory as MC.f)
	or fail since the symbol lpost is missing.
In the first case, dyn.load("MC.dll") will then work.

What I would like to have under linux:

	MC and ESCA turned into separate shared libraries (.so or .dll) 
	be able to 
	dyn.load("ESCA.so", local=FALSE); dyn.load("MC.so")
	... work work work ...
	and then
	dyn.unload("ESCA.so"); dyn.load("SomethingElse.so") which also contains the symbol lpost
	(so, I would like to unload the symbol lpost and replace it by something else)
	in the (good?) old times using S on unix running on a DECstation stuff like this was possible, but I never could get it working with R and linux.


In windows, I would like the same operation:
	dyn.load("ESCA.dll"); dyn.load("MC.dll")
	work work work
	and then 
	dyn.unload("ESCA.dll"); dyn.load("SomethingElse.dll") which also contains the symbol lpost
is this possible? I see that the parameters local and now are ignored in dyn.load for windows but I don't grasp the full meaning.

Summary questions:
1. what are the proper parameters for (Windows) Rcmd.exe SHLIB MC.f such that it does not complain about a non existing name "lpost"? 2. how can I unload the container of "lpost" such that I can replace it while R continues running (under Windows and Linux)?

Sorry for lengthy explanation.

Christian Ritter
Senior Statistical Consultant
Analytical and Statistical Services
Shell Coordination Centre S.A.
Monnet Centre International Laboratory, Avenue Jean Monnet 1, B-1348 Louvain-La-Neuve, Belgium

Tel: +32 10 477 349 Fax: +32 10 477 219 Email: christian.ritter@shell.com
Internet: http://www.analyticalsolutions4u.eu

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jul 11 20:26:54 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 11 Jul 2006 - 22:16:48 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.