I want to see the mangled name of this code. How should I do it.
I have tried this by compiling the code using G++ compiler and seeing output as ./a.out but nothing is printed. I have read about dumpbin.exe in windows but I do not have any idea about Mac.
nameMangling.cpp
// This demonstrate the nameMangling of function to make their signature.
int square(int x){
return x*x;
}
double square(double y){
return y*y;
}
void nothing1(int a, float b, char c, int &d){
}
void nothing2(char a, int b, float &c, double &d){
}
int main(){
return 0; // Indicate successful termination
}
The expected result is
__Z6squarei
__Z6squared
__Z8nothing1ifcRi
__Z8nothing2ciRfRd
_main
Any light on my problem will be Appreciated. Thank You
If you don't have binutils
installed, install that package. This is probably a good place to start: Install binutils on Mac OSX
Then nm a.out
should show you the mangled names and nm -C a.out
should show you the demangled names.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.