Re: g_module extension



On Thu, 22 Oct 1998, Michael Lausch wrote:

> Some days ago i sent this message to Tim Janik, and he told me to
> resend it to the gtk list, because it might be of potential interest
> to this list.
> 
> I have the problem that i want to load a shared library which depends
> on other shared libraries. There's no portable way of storing this
> dependency in the *.so file. Therefore libtool uses the *.la files for
> linking and extracts the additional libraries from this file. This
> method doesn't work with the current g_module implementation which
> "only" does a dlopen(). Maybe the g_module module should also use the 
> information from the *.la files to load additional libraries.

The problem is that the *.la files often contain additional libraries
we don't want do dlopen() since they're already linked with the
executable, for instance the GNOME and ORBit libraries.

> I think this functionality will become necessary when we see more
> shared library CORBA servers for the Gnome project in the future.

I have done something similar with my gmodule plugins for gEdit - it's
in ~/gnomecvs/gedit/src/gE_plugin.c.

Basic idea is not to use the *.so or *.la files but to have a description
file for each module:

[martin@einstein src]$ dir
/linux/home/baulig/INSTALL/libexec/gedit/plugins/
total 2008
-rw-r--r--  1 martin  users  720718 Oct 20 17:58 libsource_edit.a
-rw-r--r--  1 martin  users     804 Oct 20 17:58 libsource_edit.la
lrwxrwxrwx  1 martin  users      23 Oct 20 17:58 libsource_edit.so ->
libsource_edit.so.0.0.0
lrwxrwxrwx  1 martin  users      23 Oct 20 17:58 libsource_edit.so.0 ->
libsource_edit.so.0.0.0
-rw-r--r--  1 martin  users  297273 Oct 20 17:58 libsource_edit.so.0.0.0
-rw-r--r--  1 martin  users     113 Oct 20 17:58 source-edit.plugin

My gE_Plugin_Query_All () only reads the *.plugin files:

[martin@einstein src]$ cat
/linux/home/baulig/INSTALL/libexec/gedit/plugins/source-edit.plugin 
[Plugin]
name=GDB Source Editor
library_name=libsource_edit.so
deplib_0=/home/baulig/INSTALL/lib/libgdb_corba.so

Here you find the library name (the one we'll later dlopen ()) and its
dependencies - the code manages a list of all currently loaded libraries
and won't load something twice ...

------------------------------------------------------------------------

But you mentioned shared library CORBA servers for the GNOME project -
well I think we can use the *.goad description files and add support
for shared library dependencies into them, this can even be done with
some autoconf/make tricks ...

Then we can make the libgnorba keep track of the dependencies and we
don't need to worry about them any longer ...

Martin

-----------------------------------------------------------------
   Martin Baulig - Angewandte Mathematik - Universitaet Trier
   martin@home-of-linux.org, http://www.home-of-linux.org/
------------------------------------------------------------------




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