I'm currently working on a component based application for linux.
Naturally we are using dlopen and dlsym to dynamically load new
components (aka plugins). This is our dilemma, the components are
written in C++ and dlsym is having trouble locating functions within the
libraries because C++ name mangles. If we have a shared library and a
function with prototype "void printIt(int)" we can load the library and
get a pointer to printIt if we use the symbol "printIt__fi" (the mangled
form) when we call dlsym. But further, we would also like to call the
constructor of a class using dlsym. Is this even possible, or are we on
crack? If there are any g++ or ld experts out there maybe you could
offer some insight.
If anyone has any tips or ideas on where we can go with this we sure
I suppose one could get around this by having an extern "C" block around
a C function that creates an instance of a class, but we would prefer
not to do this (for the component writers sake).
Thanks for your time and help,