Re: [gtkmm] [Glib] help with Glib::Module::get_symbol
- From: Barnaby Gray <bee pickle me uk>
- To: gtkmm-list gnome org
- Subject: Re: [gtkmm] [Glib] help with Glib::Module::get_symbol
- Date: Fri, 16 Apr 2004 12:05:31 +0100
This is just a guess, but you may need to extern C the symbol to avoid
C++ symbol mangling, ie:
extern "C"
{
static IPlugin * get_module (); // permet de r?cup?rer le module
}
On Fri, Apr 16, 2004 at 12:22:57PM +0200, cedric wrote:
> hello,
> I'm using GTKMM GLIB MODULE to have a modular application.
>
> But I can't retrieve a symbol on a function which is in a module.
> I use get_symbol but it doesn't find it :o(
>
> ***********************************************************************************
> Here's my code :
> string filename = (*f).data();
> cout << "creating module with filename : " << filename << "
> ..." << endl ;
> //string modulename =
> Glib::Module::build_path("/usr/local",filename);
> Glib::Module * NewModule = new Glib::Module(filename ,
> Glib::MODULE_BIND_MASK);
> if (NewModule->gobj() != NULL)
> cout << "New module found." << endl;
> else
> cout << Glib::Module::get_last_error() << endl;
> cout << "getting symbol ... " ;
> *bool found = NewModule->get_symbol ("get_module", ptr_plugin);*
> if (found) {
> cout << "adding module into the list ... " ;
> list_plugin.push_back((IPlugin *) ptr_plugin);
> cout << "ok. " << endl;
> ***********************************************************************************
> And the module : (in a library with extension .so)
> IPlugin * get_module ()
> {
> std::cout << "get_module() ok." << std::endl;
> return new test;
> }
>
> IPlugin is the interface of my module.
>
> ***********************************************************************************
> The header of my module :
> #ifndef EASYGEST_TEST
> #define EASYGEST_TEST
> #include <gtkmm.h>
> #include "IPlugin.hh"
> static IPlugin * get_module (); // permet de r?cup?rer le module
> class test:public IPlugin
> {
> public:
> static void print ();
> test ();
> virtual ~ test ();
> virtual Gtk::Menu_Helpers::MenuElem getMenuName ();
> virtual Gtk::TreeModel::Row getTreeNode ();
> Gtk::Menu_Helpers::MenuElem * MenuName;
> Gtk::TreeModel::Row TreeNode;
> };
> #endif
> ***********************************************************************************
> When executing :
>
> creating module with filename : ./Plugin/libtest.so ...
> New module found.
> getting symbol ... symbol not found !
>
> I don't understand why get_symbol don't find my function get_module !
>
> If you have any idea ...
> THANKS
>
> Seb.
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]