g_module_symbol error



Recently I have been working on dynamically loading libraries for my application
with GModule. I have a source file that contains this function:

G_MODULE_EXPORT PluginState init (Plugin *p)
{
  /* Do something */
}

A library is created with libtool with the parameters '-module' and '-avoid-version'
passed to it in the Makefile.am. I then try to access it with this code:

GModule *module;
module = g_module_open (library, G_MODULE_BIND_LAZY);
if (!module)
  error (g_module_error());
else
  if (!g_module_symbol (module, "init", (gpointer*)&init)
    error (g_module_error());

I've gone through the API docs a few times as well as some code from
various other open source projects, but cannot figure out what I am
screwing up. I know it is probably something stupid, but any help would 
be much appreciated. Thanks!

---
Andrew Krause





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