This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: name mangle function?
- To: Steve Boswell <sboswell at bbn dot com>
- Subject: Re: name mangle function?
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 12 Jun 2001 20:52:54 -0300
- Cc: gcc at gcc dot gnu dot org
- Organization: GCC Team, Red Hat
- References: <3B24CDDB.491C3BD8@bbn.com>
On Jun 11, 2001, Steve Boswell <sboswell@bbn.com> wrote:
> would be to have access to a function that, given a class/method in the
> C++ source, will give me a null terminated string representing the
> mangled symbol name as produced by the compiler.
> Is there such a function in gcc?
Nope. Think namespaces, nested classes, argument types, etc, and
you'll see it's not that simple. Besides, dlsym would only be useful
for static methods (you can't use the pointer dlsym would return to
call a non-static method).
In general, the advice I give to people who want to dlopen C++
libraries is to define a library interface with extern "C" functions
(or static methods), or with global variables of object type
containing pointers to methods. Neither extern "C" functions nor
global variables are subject to name mangling.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me