Ideas for runtime loading of shared libraries.

Jacob Carlborg doob at me.com
Tue Jan 3 09:40:45 PST 2012


On 2012-01-03 17:49, Martin Nowak wrote:
> 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.

Do they? Isn't classinfo part of the module info and the module info 
needs to be collected in one place otherwise ClassInfo.find and similar 
methods won't work correctly?

Or can those functions be implemented to iterate all loaded libraries 
and then look through each module info?

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

Can't the runtime just run all finalizers for a given library when it's 
unloaded?

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list