Creating an app with optional GTK support

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

 



Hi,

I'm currently developing an X11 app and would like to use GTK only for the
file chooser dialog. The rest is done entirely in X11. However, the GTK
support shall be optional. If GTK is there, then my app will use the GTK
file chooser. If GTK is not there, I'll simply ask for a file name using a
fgets() on stdin :-)

Now to my question: Because I want my app to run even if GTK is not
present, I can't link against the GTK libs. Instead, I have to use
dlopen() and manually read the function pointers of the functions I need
using dlsym(). This all works fine so far, except one thing: There are
name discrepancies across the different distros. For example, comparing
openSUSE and Ubuntu:

openSUSE .so names:
1) libgtk-x11-2.0.so
2) libglib-2.0.so
3) libgobject-2.0.so

Ubuntu .so names:
1) libgtk-x11-2.0.so.0
2) libglibmm-2.4.so.1 !!!
3) libgobject-2.0.so.0

Especially striking is that Ubuntu doesn't have a libglib-XXX.so at all,
but only a libglibmm-XXX.so! So what would be the best strategy to make my
app work even with those diverging *.so names? I guess the only way would
be to manually scan the libs in /usr/lib/ and compare against the
patterns:

libgtk-x11-*.so.*
libglib-*.so.*
libglibmm-*.so.*
libgobject-*.so.*

And then choose an appropriate .so for dlopen(). Or does anybody have a
better solution?

Thanks,

Andreas
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux