[Glade-devel] [glade3, patch] load library module before calling *_get_type ()



On Thu, 2004-01-08 at 22:45, ext Joaquin Cuenca Abela wrote:

[the "libglade" + foo -library instead of "libfoo"]

That's the library that it's loaded by g_module_open in the code that you
move with your patch, and it's unrelated to the library that contains the
real Foo widget.

Is it really unrelated?  It's using the widgets in the widget library
and thus needs to be linked with it, doesn't it?


As you see, there's a missing piece, and it's the code that loads the
library that contains the Foo widget, as you need it to call the
foo_get_type function. That is, AFAIR, the only missing thing to make the
plugable widgets really work.

Hmm.. but the code that loads the library is already there, in gmodule. 
Let me try to explain.  If you don't need any wrapper code, you can just
load the library directly like you said (assuming "gnomeui-2" for
example - let g_module handle the prefixes and such.)

In case you do need the wrapper, you simply load the wrapper library
instead ("gladegnomeui-2" for example.)  Since the wrapper must depend
on the real widget library it gets automatically loaded as well in the
process.

In essence the whole module loading could actually be as simple as the
following (unless I'm missing some fundamental reason for constructing a
strictly formatted library name - I think it's just unnecessary.) 
"library" is verbatim the attribute value, error checking and all
ignored for brevity:

module = g_module_load (g_module_build_path (MODULES, library));
if (!module)
        module = g_module_load (g_module_build_path (NULL, library));


At least that's how I've understood g_module_open works, please correct
me if I'm wrong.


-- 
Tommi Komulainen <tommi komulainen nokia com>




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