R-beta: dyn.loading

Heiner Schwarte schwarte at feat.mathematik.uni-essen.de
Fri May 30 12:30:56 CEST 1997

Martin would like to have available the following

    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. 


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