After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 132364 - Glib::Module::get_symbol not setting function pointer?
Glib::Module::get_symbol not setting function pointer?
Status: RESOLVED NOTABUG
Product: glibmm
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2004-01-24 04:22 UTC by Nick Welch
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.1/2.2



Description Nick Welch 2004-01-24 04:22:20 UTC
I had a conversation with danielk on irc and neither of us could figure out
what the problem was here.  I want to use Glib::Module in a project of
mine, so I was concocting a simple test first.  But I still haven't gotten
the simple test to work.

The problem is with get_symbol(); no matter what I try, it doesn't point my
function pointer to the requested symbol.  It does return true, and
everything else is successful, but my function pointer, which I initialize
to NULL, stays NULL.

It could very well be a problem with my (crappy) understanding of function
pointer syntax -- but I do manage to limp along ok with everything else.

So I have 3 tests now.  They all basically do the same thing, one with
libdl/dlopen()/et al, another with C glib and GModule, and the third with
gtkmm's Glib::Module.  The first two work great.  The problem with the
third is beyond me, and trust me, I have tried a *ton* of things.  So it
was suggested to me to file a bug.

The tarball with the 3 tests and makefile is here:
http://incise.org:82/~death/pub/module-tests.tgz
Comment 1 Nick Welch 2004-01-24 06:15:35 UTC
Hm, it looks like this is probably something I'm doing wrong, because
I managed to get the symbol by doing:

void * v;
mod.get_symbol("cos", v);

And then this works ok:

cerr << (*(double_double_func_t)v)(1.2) << endl;
Comment 2 Murray Cumming 2004-03-13 22:39:34 UTC
Yes, you should not expect a cast like that to work. function pointers
are strange and compiler-dependent.