Library unloading (Re: [PATCH] auto-completing URLs on Ctrl-Enter)

Martijn Klingens klingens at kde.org
Sat Feb 4 12:51:06 GMT 2006


On Saturday 04 February 2006 13:23, Thiago Macieira wrote:
> A library can be unloaded if and only if:
> - you have no pointers into its memory addresses
> - you have no objects of classes defined there
> - you have no objects created there that could be using a non-global
> symbol (libraries are loaded without global binding)
>
> And by "you", I mean "everything loaded in your program that is not the
> library itself", including other loaded modules.

I'm not sure what you mean with the last of your 3 points. To take the example 
of Kopete back when I wanted this (about 3 years ago), there was libkopete 
and there was the MSN plugin, and of course the main app with kdelibs and 
friends.

I wanted to dlclose the MSN plugin and reload it. Back then the first two 
requirements you listed were true because I explicitly made sure they were 
true, and fixed the occurrences that violated the rule.

But now your last item. You said "you have no objects created there [...]", 
but the way I interpret that this cannot be true anyway by the time the 
dlclose happens, since with proper memory management all objects are deleted 
by then. Perhaps not really needed for the normal app termination case, but 
absolutely required if you want to design plugins for hot unloading and 
reloading, so I'm not sure I see the relation with symbols being global or 
non-global. Could you explain?

-- 
Martijn




More information about the kfm-devel mailing list