Re: R-beta: dyn.loading

Heiner Schwarte (schwarte@feat.mathematik.uni-essen.de)
Fri, 30 May 1997 11:30:56 +0100 (NFT)


Date: Fri, 30 May 1997 11:30:56 +0100 (NFT)
From: Heiner Schwarte <schwarte@feat.mathematik.uni-essen.de>
To: r-help@stat.math.ethz.ch
Subject: Re: R-beta: dyn.loading
In-Reply-To: <x2lo4xjpc4.fsf@bush.kubism.ku.dk>
Message-Id: <Pine.A32.3.93.970530112708.16820C-100000@feat.mathematik.uni-essen.de>


Martin would like to have available the following
functions: 

    is.loaded(), symbol.C() and symbol.For()

It would be easy to implement is.loaded() by checking the internal
symbol table and libraries that have been loaded; symbol.C() would just
return the argument and symbol.For() would add an underscore if the
Fortran compiler does so.

Although Martin does not explicit ask for dump.loaded(), such a 
function might also be desirable. But currently dump.loaded() is
not feasible for the following reason. The libraries are accessed
using dlopen() and friends. After loading a library any global
symbols are available and probably there is no way to separate
the symbols-meant-to-be-used-by-the-dyn.load-interface from 
auxiliary symbols. (This is the generic case. Under AIX and
probably Win32 it would be possible.) Currently R does the 
following. If a symbol is not found in the symbol table, libraries 
that have been loaded by dyn.load are searched for the desired symbol. 
Once the symbol is found, it is added to the symbol table.

There is no way to unload or reload a library. This would be helpful 
for debugging.  (On the other hand, it is strongly recommended only 
to load correct code because memory errors in the loaded code may mess 
up R's internal data structures) Some time ago I was thinking about the 
un(re)loading of libraries. But at that point of time Linux didn't 
follow its documentation (bug/feature?) regarding dlopen(). Therefore 
I did not pursue this topic any further. Is it worth to put un(re)loading
of libraries onto the priority list? Implementing this feature would 
essentially require a rewriting of the dyn.load facility which might 
threaten the stability of R. 

Heiner

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=