How to unmangle exported symbols from C++ in dynamic libraries in XCode on OSX

Posted by Gerald on Stack Overflow See other posts from Stack Overflow or by Gerald
Published on 2010-12-22T05:39:55Z Indexed on 2010/12/22 5:54 UTC
Read the original article Hit count: 268

Filed under:
|
|
|

I've been trying to develop a dynamic library in C++ that can be run-time loaded in an application. I finally got it working, but it's a little ugly. I have a function that takes a pointer to a C++ class as an argument, which looks like this:

bool registerGrindPlugin( Grind::PluginManager* mgr );

But of course it's being exported as:

_Z19registerGrindPluginPN5Grind13PluginManagerE

I tried a .c file with a simple function and it exported fine as "registerGrindPlugin", but of course I can't pass a C++ class as the argument that way.

Soo... my question is, is there a way to unmangle or alias the exported symbol so that I don't have to use a monstrosity like Z19registerGrindPluginPN5Grind13PluginManagerE in my dlsym call?

I did see something about -alias_list as a linker option, but I haven't quite figured out how to use it in XCode. If that is the solution, can somebody provide some more details on how to use this?

© Stack Overflow or respective owner

Related posts about xcode

Related posts about osx