Unable to dlopen(test.so): test.so: Undefined symbol "_ZN6moduleD2Ev"You may wonder why the symbol looks so ugly. Actually, this conversion of symbol is called name mangling. C++ supports polymorphism, this means functions can have same name but different types and numbers of parameters. Therefore, compiler cannot just use the function name as the symbol. Instead, both function name and parameter types should be included in symbol naming. Name mangling is the technique to encode a function name and parameter types into one symbol.
To translate the mangled symbols to more meaningful text, we can use the
c++flit
utility. E.g.ahlam@oxygen:~$ c++filt _ZN6moduleD2EvNow, you know "_ZN6moduleD2Ev" is the destructor of
module::~module()
class module
.