What is your actual question?
Dynamically loading C++ classes isn't really something you want to do directly, due to "name-mangling", among other things. However, there is another way.
What you generally do is to create functions that create and delete an instance of your class.
Suppose you've got a class "MyClass"
Code:
extern "C" MyClass *create(int some_parm)
{
return new MyClass(some_parm);
}
extern "C" void destroy(MyClass *p)
{
delete p;
}
The "destroy" function is needed because you can't guarantee that the implementation of new/delete in the application and the plugin are compatible.
Of course when writing plugins, you usually derive from a common base class for all your plugins, so you'd get something more like this:
Code:
extern "C" MyBaseClass *create(int some_parm)
{
return new MyClass(some_parm);
}
extern "C" void destroy(MyBaseClass *p)
{
delete p;
}
Most of the time people wrap all that into a macro, so all you'd have to do in the implementation of your plugin would be something like:
Code:
EXPORT_PLUGIN(MyClass)
http://www.tldp.org/HOWTO/C++-dlopen/ has some more information on the subject.