How can I see the mangled names of the functions in my program? | Sololearn: Learn to code for FREE!
0

How can I see the mangled names of the functions in my program?

i've been searching this all over the internet and i can't understand name mangling. please help me, this is my report in my programming class. any help will be much appreciated, more power to sololearn

17th Feb 2020, 1:49 PM
Kenneth Santos
Kenneth Santos - avatar
3 Answers
+ 3
To see mangling names of your functions you must open object file (.o or .obj) of your compiled code with special viewers (or you can use text viewer).
17th Feb 2020, 2:53 PM
andriy kan
andriy kan - avatar
+ 3
In simple words name mangling is "renaming" c++ function declaration (including type of parameters) to symbolic representation. That renamed name is used on linking stage. As your program can have overloaded function with same name but different parameters, linker must definitly know what function to use, so types of parameters are encoded to the name. All libraries export c++ functions names as mangled names. For example, mangling name for void f(void); could be _Zfi void f(void); could be _Zfv void f(char , int); could be _Zfci Name mangling is compiler specific.
17th Feb 2020, 2:25 PM
andriy kan
andriy kan - avatar
0
thanks a lot, it's clear now
22nd Feb 2020, 5:15 AM
Kenneth Santos
Kenneth Santos - avatar