Is there any way to get back the mangled name from demangled name in g++.
For example , I have the demangled name func(char*, int)
, what should I do to get the mangled name i.e _Z4funcPci
back?
My question is g++ specific.
You can simply use g++ to compile an empty function with the signature you require and extract the name from that. For example:
echo "int f1(char *, int) {} " | g++ -x c++ -S - -o- | grep "^_.*:$" | sed -e 's/:$//'
gives output
_Z2f1Pci
which is I think what you require. Make sure that you include any relevant header files as they will affect the way the symbols are mangled.