Hi everyone.
I have aproblem, i don't know how to solve.
I have an abstract class, yea pure virtual, which serves as an interface.
Then in a shared object i made an implementation of the base class.
With another class i made all the loading things. Everything compiles fine.
But when i run it, it says something like:
Quote:
ERROR: Couldn't load DPI_Render/DPI_render_OGL/libdpiogl.so
DPI_Render/DPI_render_OGL/libdpiogl.so: undefined symbol: _ZN11cDPI_RenderD2Ev
where cDPI_Render is the name of my abstract class.
Here are the relevant portions of my code.
//This the base class
#ifndef DPI_RENDER_DEVICE
#define DPI_RENDER_DEVICE
class cDPI_Render {
public:
cDPI_Render(){};
virtual ~cDPI_Render(){};
virtual bool Init(int width, int height)=0;
virtual void ClearScreen(float r, float g, float b)=0;
virtual void Update(void)=0;
virtual void Release(void)=0;
};
extern "C" {
bool createRenderDevice(cDPI_Render *dpird_ptr);
void releaseRenderDevice(cDPI_Render *dpird_ptr);
};
#endif
I used extern "C" so the names don't get screwed up int the shared object so i could get them easily with dlsym(...)
This is the code that fails:
bool cSOLoader::create(int flag, char *shName)
{
bool (*render_ptr)(cDPI_Render *dpir_ptr);
bool (*input_ptr)(cDPI_Input *dpii_ptr);
bool hres;
switch(flag)
{
case DPI_RENDER:
sh_module[DPI_RENDER]=dlopen(shName, RTLD_NOW|RTLD_GLOBAL);/*Here it fails*/
.
.
.
.
And finally, the test program which shows how i load the library.
#include"DPI_Render/dpi_render.h"
#include<stdio.h>
int main(int argc, char *argv[])
{
cDPI_Render *render;
cSOLoader loader;
printf("Iniciando\n");
loader.create(DPI_RENDER, "DPI_Render/DPI_render_OGL/libdpiogl.so");
puts("Loader creado");
render=(cDPI_Render*)loader.getObject(DPI_RENDER);
puts("Render creado");
loader.release();
puts("Adios");
return 0;
}
Somehow the name of the abstract class gets screwed when compiling the shared object.
Any ideas how to fix this?