Problems with modules



I have a plugin structure similar to this in an Anjuta project based on gtkmm:

//-------------- Plugin.hpp

#ifndef _PLUGIN_HPP_
#define _PLUGIN_HPP_

#include <glibmm/ustring.h>
#include "config.hpp"

#define INIT_PLUGIN(plugin_class) \
   extern "C" CPlugin* createPlugin(){ \
       return new plugin_class; \
   }\
   \
   extern "C" void destroyPlugin(CPlugin* p_plugin){ \
       delete p_plugin; \
   }\


class CPlugin;


typedef CPlugin* t_CreatePlugin();
typedef void t_DestroyPlugin(CPlugin* p_plugin);

/*------------------------------------------------------
   Clase base para la creación de plugins.
--------------------------------------------------------*/
class CPlugin
{
public:
   CPlugin(void){
       m_type = -1;
   }
virtual ~CPlugin(void){}

   int getType(void){
       return m_type;
   }
virtual bool init(void){}

   void setCfg(CConfig* p_config){
       m_config = p_config;
   }
protected: int m_type; CConfig* m_config;
};

#endif // _PLUGIN_HPP_


//-------------- TestPlugin.hpp

#ifndef _TESTPLUGIN_HPP_
#define _TESTPLUGINHPP_

#include "plugin.hpp"

class CTestPlugin: public CPlugin
{
public:
   CTestPlugin(void):CPlugin(){
      m_type = 1;
   }
~CTestPlugin(void){}

   bool init(void){
      if(m_config){
         m_config->getDir();
      }
   }

};

INIT_PLUGIN( CTestPlugin )

#endif // _TESTPLUGIN_HPP_

//-------------------------------------------------------------------------

The loading of a TestPlugin is correct, but when I try the next code:

...
CConfig aCfg;
...
aTestPlugin->setCfg(&aCfg);
aTestPlugin->init();
...

I got the next error in the call to init:
./test: symbol lookup error: ../plugins/.libs/libtest.so.0: undefined symbol: _ZN13setCfgC1Ev

Other problem I have, is that I can't move the implementation code of Plugin members to a .cpp file, because I have the same error but with the members of Plugin: ./test: symbol lookup error: ../plugins/.libs/libtest.so.0: undefined symbol: _ZN13CPluginC1Ev

Please I need Help on that!!!!


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