From: Gabriel D. R. <gd...@in...> - 2008-10-09 16:49:31
|
On Thu, Oct 9, 2008 at 1:25 AM, Nikodemus Siivola <nik...@ra...> wrote: > On Wed, Oct 8, 2008 at 11:32 PM, Gabriel Dos Reis > <gd...@in...> wrote: >> Hi, >> >> I went through the docs, but I could not find a way to unload >> dynamic libraries loaded before executing save-and-die? > > Not nicely. If you pop the hood you can look at > SB-SYS:*SHARED-OBJECTS* and change the SHARED-OBJECT-FILE pathname -- > but that is definitely not supported. > > What would be a good API for this? > Thanks for the suggestion. The way I was seeing this was that I was under the impression that I could define a foreign function -- without loading the foreign library first -- and as long as I do not call that function, every thing is OK. But, I would have to load the library before the first use of the foreign function. Is that impression just a side-effect of implementation details? By extension, I thought that it could be quite possible to unload the libraries before save-and-die, and reload them on start up before calling the foreign function. This would mean that the foreign function gets associated with a thunk (to catch illegal calls) when their containing foreign libraries are unloaded, and they would be rebound once the libraries are loaded again. >> The reason I would like to do this is that the path to the libraries >> I loaded may change (say after installation of the application), but the path >> recorded in the image saved by save-and-die are absolute pre-installation >> path -- which are no longer good. > > If you use LOAD-SHARED-OBJECT without a full path and make sure the > libraries are in LD_LIBRARY_PATH, things should "just" work. > > Of course, for deployment this may require you to have a wrapper > script that sets up the correct paths, unless you can make sure things > are installed in the normal path. Hmm, I was hoping I would not have resort to LD_LIBRARY_PATH especially because I was want to run on Windows, where the search path rules differ. Is there a hope for 'static linking' with SBCL? Thanks! -- Gaby |