Re: R-beta: dyn.loading

Heiner Schwarte (
Fri, 30 May 1997 11:30:56 +0100 (NFT)

Date: Fri, 30 May 1997 11:30:56 +0100 (NFT)
From: Heiner Schwarte <>
Subject: Re: R-beta: dyn.loading
In-Reply-To: <>
Message-Id: <>

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
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: