11 Feb 2004 pfremy   » (Journeyer)

Looking for DLL system
I have been looking for a very small plugin system, that should be portable between linux and windows. There is only one function inside the plugin and I have full control on who writes the plugin and how it is written. Actually, the term plugin is exagerated, I just need a portable DLL loader. I am considering writing it myself, since the dlopen and GetProcAddress stuff does not look too complicated.

But I had a look on what I could find on the net. The closest thing I found was xplc but xplc is a component framework and I just need a DLL loader. Another search lead me (to my surprise) to glib and its gmodule. I did not know glib has a plugin facility. Hey, that's something Qt has not although there was a failed attempt with qlibrary. Anyway, since I work on windows and I want free as in beer software library for this small project, I can not use Qt. GModule seems to do what I need, so I investigate further.

First, I discover that glib has no homepage. Try www.glib.org and have some fun. developer.gnome.org hosts some API documentation bug the glib tarball is not available on ftp.gnome.org (or I could not find it), and it seems that they have never heard of windows port.

I wanted to browse the source of gnome and was surprised no to see any link to bonsai or lxr. I realised later that the link was hidden by some unreadable text, because developer.gnome.org renders ugly in konqueror (uh uh).

So, no glib source code for me, nothing known about windows, no place to download it. I google more I find gimp in win32 which seem to contain what I am looking for.

However, it seems that glib depends on gettext and libiconv. I am annoyed by this because of the usually poor windows portability or any linux program. Also, installing the whole glib + gettext + libiconv just to get DLL opening seems overkill to me. Other people working on my project don't like extra dependancies.

I also find out that www.gtk.org seem to be the home of glib. Glib seem to be inside gtk whereas I thought that glib was promoted to be indepentant of gtk (at least that's what I read on freedesktop). Ok, but what about my source code ? There seem to be no bonsai/viewcvs/lxr on www.gtk.org .

Since the documentation link points to developer.gnome.org, I checked again and this time, I found the bonsai link. I can finally browse the source on the web. This is exactly what I thought: the gmodule file is very simple and can be easily integrated into a foreign application without using the whole glib framework. Hurrah! It is LGPL so there is no consequence for my (closed source) application.

This also gave me the opportunity to read more about GObject. The whole thing is quite impressive. The developers have really put out a complete object framework. I think this kind of thing is unnecessary because you can find all the facilities provided by gobject directly in C++ but it does not diminish the quality of their work. Of course, because or the limitations of C, the syntax is awful. But that's common to most glib/gtk programs.

Regarding glib, I think it really deserves its own homepage, instead of being drown under gtk stuff.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!