Ideas for runtime loading of shared libraries.

Martin Nowak dawg at dawgfoto.de
Tue Jan 3 08:49:17 PST 2012


On Tue, 03 Jan 2012 08:22:47 +0100, Jacob Carlborg <doob at me.com> wrote:

> On 2012-01-02 21:57, Martin Nowak wrote:
>>> Then also unload all this when the library is unloaded.
>>>
>> It seems that libraries can't be unloaded deterministically,
>> because GC finalization still references them.
>
> Could you elaborate this, I guess I'm not really familiar with the GC  
> finalization.
>
I stumbled over this issue while doing extended testing.
Consider unloading of a library, this requires you to not
use any data/functions from that library afterward.
If you have instantiated a class from that library the GC
will access it's classinfo when collecting it, but the
classinfo resides in the unloaded library as do finalizers.

Not collection all classes from a shared library before
unloading that library is currently impracticable.

We could allocate classes from a specific allocator associated
with the library, somewhat similar to how TLS is allocated for
each library.


More information about the Digitalmars-d mailing list