R-beta: WISH: For dyn.load()ing, I'd like is.loaded(.) , symbol.C, symbol.For
luke at stat.umn.edu
Thu May 29 17:53:59 CEST 1997
Martin Maechler wrote:
> In S(plus), I can write functions using code fragments like
> r <- .C("my_C_fun",
> x = x,
> n = n,
> which I would like to have in R, too.
I'm a bit worried that this might impose too many restrictions on how
dynamic loading is implemented. In particular it sort of assumes the S
model where all symbols in dynamically loaded code are entered
automatically in one global name space. With shared libraries a
mechanism that allows you to explicitly import foo from libA and bar
from libB may make more sense. The S design dates back to well before
shared libraries became commonly available; before making a commitment
to support the existing design it would be a good idea to consider all
the options in light of what is supported by ELF shared libraries, Mac
shared libraries and Windows DLL's and what seems most natural in
terms of the common facilities they provide.
Overall, I am not that thrilled with the S design in which you get a
function pointer along with all the rope you need to hang yourself. I
would prefer a scheme where you need to write a declarative interface
stub that says something like
myCfun<-make.Cfun("foo","libA", x="double *", n="int *", ...)
which then goes away and generates the appropriate function with all
the right as.whatever's needed to reduce the chance of nuking yourself
if you don't get the arguments right (for the truly brave or those
desparate for speed the low level implementation mechanism could be
exposed too, but at least you wouldn't have to work at the raw
function pointer level unless you choose to).
As far as deciding whether something is loaded or needs to be loaded,
I believe that would usually be much better handled by a
module/dependency mechanism rather than by explicit loading commands
in user code.
Just my 2c worth.
> 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
University of Minnesota Phone: 612-625-7843
School of Statistics Fax: 612-624-8868
206 Church Street email: luke at stat.umn.edu
Minneapolis, MN 55455 USA WWW: http://www.stat.umn.edu
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