[comp.lang.c++] name mangling and dynamic linking

aed@netcom.COM (Andrew Davidson) (04/02/91)

Hi I have been building some proto types in c++ that take advantage of
true dynamic linking and loading. One of the problems I found in that
I am required to know the symbol name of the function.

In C this is no problem as the function int f(int) has the symbol name
_f. Since C++ mangles function names this in not the case. I know that
I can get the name mangling stuff from gnu g++, but am I guaranted
that all c++ compilers will mangle the same way?

thanks in advance Andy
-- 
-----------------------------------------------------------------
                  "bede-bede-bede Thats all Folks"
				Porky Pig
Andy Davidson
Woodside CA.
aed@netcom.COM
-----------------------------------------------------------------

kelley@mpd.tandem.com (Michael Kelley) (04/02/91)

In article <1991Apr1.165144.3011@netcom.COM>, aed@netcom.COM (Andrew
Davidson) writes:
> 
> Hi I have been building some proto types in c++ that take advantage of
> true dynamic linking and loading. One of the problems I found in that
> I am required to know the symbol name of the function.
> 
> In C this is no problem as the function int f(int) has the symbol name
> _f. Since C++ mangles function names this in not the case. I know that
> I can get the name mangling stuff from gnu g++, but am I guaranted
> that all c++ compilers will mangle the same way?
> 
No, I don't believe there is a standard mangling scheme.  In light of this,
I've put together a portable name mangler.  Problem is, it's rather slow,
and it's only as good as your name demangler.  (Sun's 2.0 demangler has
problems with static members, for example). It works by generating dummy
class declarations in /tmp, running your compiler, then filtering the
resultant symbol tables.  But if you don't use it with every build, it's
alright.  Anyone needing such a beast, drop me a note -- if there's enough
interest, I'll post.

> thanks in advance Andy

You're welcome 8-).

Mike Kelley
Tandem Computers, Austin, TX
kelley@mpd.tandem.com
(512) 244-8830 / Fax (512) 244-8247