Re: [gtk-list] Loading 2.6 symbols when linked against 2.4



Hi,

On Thu, 14 Sep 2006 14:34:57 -0700
Ian King <king eiffel com> wrote:
>Our application is linked against gtk 2.4, however we would like to be 
>able to call functions from gtk 2.6 if they are available on the system 
>(for things such as text ellipsis rendering from pango).  Can gmodule be 
>used for loading these functions and has anyone done this successfully?

If the functions to be checked is in yet-not-loaded pluggable
modules (e.g. pango-arabic-fc.so), g_module_symbol() will be
useful.

But, ellipsis issue is slightly different, because it is in
libpango, and it is linked at once when the program is started.
It's out of gmodule framework, so we don't have module object
for libpango, as a result, g_module_symbol() cannot scan the
symbols in libpango - I suppose.

In the case of mozilla, to check the optional functions in FreeType,
very complexed trick is used. See mozilla/gfx/src/freetype/nsFreeType.cpp.
Yet I've not read their implementation, I guess the procedure is
following.

1. get the full pathname of libfreetype.so (or .sl, .dll, .dylib etc)
   from preference.

2. execute dlopen() (or anything compatible) against the library
   and bind it to current process. the handle of (new) libfreetype.so
   is obtained.

3. execute dlsym() against the handle to lookup optional functions.

I think similar technique is usable, but I'm really suspicious
against its portability.

Regards,
mpsuzuki



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