Re: gmodule help



Greg Steffensen wrote:
Hey, I'm trying to use gmodule, but am unfamiliar with libtool and linking, and am unsure about what compilation commands to use (I've gone through the libtool info pages, but still can't quite get it to work). Can anyone tell me how to compile a single source file that uses glib and gmodule into a ".so" file on Linux, such that gmodule can use it? I've pasted the source for the very simple test library and test executable I'm trying to get to work below, though I don't expect that their contents are important. Many thanks,

It is probably overkill, but you can take a gander at the Makefile.am Makefile.in configure and configure.ac in:

http://www.netperf.org/svn/netperf4/branches/glib_migration

for examples of what may not be pristine, nor adhere to chapter and verse, but seem to be functional use of libtool with automake et al and GModule.


test.c (an executable that loads the library at runtime)
------------------------
#include <glib.h>
#include <gmodule.h>

#define PLUGIN_FILE "./libtestplugin.so"

One thing I've just learned getting netperf4 to work on Linux, HP-UX, AIX, MacOS X and Windows is that "g_module_open means never having to include the suffix" so you can, and perhaps should (?) drop the ".so"

rick jones



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