Re: Unloading sequence of GTK



Hi!

If unloading glib together with gtk is acceptable you can replace the 
g_atexit function so you keep your own list and call it just before 
dlclose()

See (and copy/paste) this great code:
http://download.insomniavisions.com/sources/uncompressed/cplusplus/g_atexit.cpp

Of course this works only on *NIX (ELF executables) where symbols are
global and you can replace them with those already in memory.

Having a way to unwind all functions registered by the normal g_atexit 
would be nice.

Paul Chitescu

On Mon, 20 Mar 2006, Clemens Fruhwirth wrote:
> Hello,
> 
> I would like to ask how to properly unload gtk from a process image,
> when it has been brought there via dlopen. The initial situation is that
> I need to enter gtk's main loop in a single process image multiple
> times, but that's not possible with gtk as gtk assumes a fresh image.
> 
> Hence, I load gtk temporarily via dlopen enter the main loop and after
> that's finished, remove gtk via dlclose. When another run is needed, gtk
> is loaded freshly via dlopen.
> 
> BUT, gtk fails to unload itself completely when dlclose'd. For instance,
> the theme library stays in the process image and of course introduces a
> dependency on libgtk and all its fellows. Hence, gtk doesn't unload.
> 
> Can someone give me an advice on this issue? I browsed and grepped
> through the source but it seems if there is a general unloading method I
> failed to find it. I'd figure this would go into the fini section of the
> library.
> 
> Thank you,
> 
> Please Cc me, I'm not subscribed.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]