This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
I have a chunk of code that loads a shared library + a file containing a list of functions in that library (it's a scripting language parser, for the curious - the functions implement verbs in the scripting language).
This works fine with C functions, as the dlsym() function can find the function name in the shared lib. However, with C++ functions it won't work unless you pass the mangled function name in to dlsym. So I would either have to put the mangled name in my function definition file (and that would change based upon the specific C++ compiler used - I'd like to support both GCC and MSVC if possible). Putting aside the issue of different compilers for the moment, is there a way to, given a string such as "void foo(int&)" convert that to the mangled name GCC would emit, and do so at run time?
e.g.
int my_example(vector<string> names) { for (vector<string>::iterator i = names.begin();i != names.end(); ++i) std::cout<< "Function "<< *i<< " mangles to "<< some_magic_libgcc_function((*i).c_str())<< std::endl; }
-- Kevin P. Fleming Digium, Inc. | Director of Software Technologies Jabber: kfleming@digium.com | SIP: kpfleming@digium.com | Skype: kpfleming 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA Check us out at www.digium.com & www.asterisk.org
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |