I have a system in which I give the user a function prototype and the user has to implement it. Now, I compile this file using g++ and load it dynamically using dlopen and d
Since you are using C++, why don't you export only one (or two) functions that will simply return a pointer to some kind of pure virtual class, say IMyModule
? The one (or two) exported extern "C"
functions would be something similar to extern "C" IMyModule * create_instance_IMyModule();
(and extern "C" void delete_instance_IMyModule(IMyModule const *);
).