Ilya Zakharevich on Tue, 26 Nov 2002 12:31:45 -0800 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Patch for install: allow to change prototype |
On Tue, Nov 26, 2002 at 02:55:33PM +0100, Karim BELABAS wrote: > > BTW, I see no reason to have the warning at all. How is it different from > > ? f() = 12 > > ? f() = 12 > > I don't know how to safely "reload" a symbol from an external library. In > particular, you cannot recompile an external module, and re-install a > routine. You can kill() its GP wrapper, then formally re-install it, but > unless dlclose() is called first, you install the old version (still loaded > in memory). If I understand it correct, the *only* information we keep about the address space of the external library is an entry in entree. Thus it should be safe to do dlclose() at the appropriate time. (Note that Perl has no notion of unloading a module due to much more flexible interface, thus uncontrollable "pollution" of data with addresses from the library.) Hmm, some results from a call to a library may contain references to static variables in the library, so maybe it is not so bulletproof... Otherwise one could keep a hash with a reference count of symbols from a library; increment it when install(), decrement when kill(). When the reference count goes to 0, unload the library. (Or unload/load it on the next install()...) Hmm, with this interface the user could keep an extra dummy install()ed function to keep a DLL from being auto-unloading if the above scenario of a PARI variable containing a reference to a static variable is applicable to a particular module... Ilya