Name Mangling Without Return Type?

Ian Lance Taylor ian@wasabisystems.com
Tue Dec 2 16:51:00 GMT 2003


"Corn Hulio " <nitrogenycs@firemail.de> writes:

> say u have a function like
>  
> bool Class::SomeFunc(int param1, COtherClass param2);
>  
> If the function name gets mangled and i try to unmangle it, i am unable to retrieve the 
> return type of it (bool in this case). Isn't there the 
> possibility to include it into the mangled name so i can get it back when unmangling? 
> msvc does this for example (i know gcc is not msvc) and i 
> think it is a very useful feature, especially for applications similar to the one 
> described here: http://www.drizzle.com/~scottb/gdc/fubi-paper.htm
>  . Can you maybe add a compiler switch or other way that includes the return type? Or am 
> I totally wrong here and the return type is already in 
> the mangled name?

Name mangling exists to disambiguate overloaded functions in C++.  You
can only overload functions based on the parameter types.  You can not
overload them based on the return type.  So the return type is not in
the mangled name.  There is no need for it.

If there were an option to add the return type to the mangled name,
which there is not, then you would have to recompile all C++ library
code with that option.  Otherwise you would not be able to call any
functions, because the compiler would be generating the wrong name.

Ian



More information about the Gcc mailing list