name-mangling

How do I list the symbols in a .so file

How do list the symbols being exported from a .so file. If possible, I'd also like to know their source (e.g. if they are pulled in from a static library). I'm using gcc 4.0.2, if that makes a difference ...

Why do we need extern "C"{ #include <foo.h> } in C++?

Specifically: When should we use it? What is happening at the compiler/linker level that requires us to use it? How in terms of compilation/linking does this solve the problems which require us to use it? ...

OSX 10.5 Leopard Symbol Mangling with $non_lazy_ptr

Why does Leopard mangle some symbols with $non_lazy_ptr? More importantly what is the best method to fix undefined symbol errors because a symbol has been mangled with $non_lazy_ptr? ...

C++ : Finding out decorated names

How can I find out the decorated name that will be asigned to each method name ? I'm trying to find out what the decorated name is , so that I may export it , in a DLL . ...

Does anyone have a link to Sun's name mangling patent?

I've seen a lot of mentions like this one that Sun has patented their name mangling scheme for C++. It's certainly true that Sun's name mangling is much more efficient than the scheme used by IBM's xlC compiler, for example. But I can't find the actual patent anywhere. Does anyone have the patent #, or a link to the patent? Thanks! ...

Unmangling the result of std::type_info::name

I'm currently working on some logging code that supposed to - among other things - print information about the calling function. This should be relatively easy, standard C++ has a type_info class. This contains the name of the typeid'd class/function/etc. but it's mangled. It's not very usefull. I.e. typeid(std::vector).name() returns "S...

Where is documentation on the Microsoft Visual Studio C++ Name Mangling Scheme?

I am interested in finding either official or reverse engineered documentation detailing the name mangling scheme used by the Visual Studio C++ Compiler to translate C++ names into symbols in generated code. I am aware that this may change between versions, and am most interested in the details for Visual Studio 2003, 2005 and 2008. Of...

View Compiler Mangled Names in C++

How do I view the compiler-generated mangled names for overloaded functions in C++? I'm using VC9 but answers for other compilers are welcome too. Edit: I find all the answers useful here. Accepting the one I liked best. ...

typeid() returns extra characters in g++

class foo { public: void say_type_name() { std::cout << typeid(this).name() << std::endl; } }; int main() { foo f;; f.say_type_name(); } Above code prints P3foo on my ubuntu machine with g++. I am not getting why it is printing P3foo instead of just foo. If I change the code like std::cout << typeid(*this).name() <...

How do I check for an unmangled C++ symbol when building a PHP extension?

I have a PHP module written in C++, which relies on a C++ library (Boost Date_Time) being installed. Currently, in my config.m4 file I'm checking for the library as follows: LIBNAME=boost_date_time LIBSYMBOL=_ZN5boost9gregorian9bad_monthD0Ev PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,, [ AC_MSG_ERROR([lib $LIBNAME not found. T...

Is there a way to suppress c++ name mangling?

I have a DLL that is written in C++ and I want to suppress the name mangling for a few exported methods. The methods are global and are not members of any class. Is there a way to achieve this? BTW: I'm using VS2008. ...

Using g++ how can I link with a library that was built using gcc?

I am trying to link a .a library that was built with gcc to a program built using g++. But the name mangling is different. How can I do this? Thanks, CP ...

What is the benefit of private name mangling in Python?

Python provides private name mangling for class methods and attributes. Are there any concrete cases where this feature is required, or is it just a carry over from Java and C++? Please describe a use case where Python name mangling should be used, if any? Also, I'm not interested in the case where the author is merely trying to preve...

Generating C++ BackTraces in OS/X (10.5.7)

I've been utilizing backtrace and backtrace_symbols to generate programmatic stack traces for the purposes of logging/diagnosis. It seems to roughly work, however, I'm getting a little bit of mangling and there are no accompanying file/line numbers associated with each function invocation (as I'd expect within a gdb bt call or something...

What is name mangling, and how does it work ?

Please explain what is name mangling, how it works, what problem it solves, and in which contexts and languages is used. Name mangling strategies (e.g. what name is chosen by the compiler and why) a plus. ...

How can I see symbols of (C and C++) binary on linux?

Which tools do you guys use? How do demangle c++ symbols do be able to pass it to profiler tools, such as opannotate? Thanks ...

How do I stop name-mangling of my DLL's exported function?

I'm trying to create a DLL that exports a function called "GetName". I'd like other code to be able to call this function without having to know the mangled function name. My header file looks like this: #ifdef __cplusplus #define EXPORT extern "C" __declspec (dllexport) #else #define EXPORT __declspec (dllexport) #endif EXPORT TCHA...

Scala: How do I dynamically instantiate an object and invoke a method using reflection?

In Scala, what's the best way to dynamically instantiate an object and invoke a method using reflection? I would like to do Scala-equivalent of the following Java code: Class class = Class.forName("Foo"); Object foo = class.newInstance(); Method method = class.getMethod("hello", null); method.invoke(foo, null); In the above code, bot...

Delphi - unmangle names in BPL's

Is it possible to unmangle names like these in Delphi? If so, where do I get more information? Example of an error message where it cannot find a certain entry in the dbrtl100.bpl I want to know which exact function it cannot find (unit, class, name, parameters, etc). --------------------------- myApp.exe - Entry Point Not Found ------...

undecorate function names with visual studio sdk

To undecorate mangled C++ names that Visual Studio generates, you can use undname.exe. But what if you want to avoid the overhead of creating a full-blown process every time you need undecoration? Is there any equivalent functionality in the Visual Studio SDK (should be supported in VS2005)? ...