Re: What does g_type_init() do when reloading the library?



Sorry, 
Ignore this as well

On Sat, Mar 19, 2011 at 12:34 PM, Hwanny Kim <ohpowel gmail com> wrote:
Hi, 

I got a problem when using GModule before. It has been fixed by using 'g_type_init()' but I don't know what 'g_type_init()' does exactly.

My situation was as follows:
My application uses GModule to load shared library, which depends on libsoup, and unload it.  There is no problem up to now. But "GLib-GObject-WARNING **: cannot register existing type `SoupSession'...." error message occurred when trying to reload the library. My application already called 'g_type_init()' in main() function at startup.  
'g_type_register_static()' is used in libsoup.  I think that lisoup trying to re register it's type (SoupSession) when closing&reloading the library even though it has been already registered.
I have found that dlopen&dlclose should be avoided in this case when googling.

However, above problem was solved simply by adding 'g_type_init()'  in the source code of shared library. Whenever reloading the library, 'g_type_init()'  will be called again and again.
This is right way to solve the problem??? What dose 'g_type_init()' do when it is called again? Does it remap the memory of all GType or remap only 'SoupSesion'? Can anyone explain this in detail??



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