c++ - Building a lib with the same symbols as another lib -
i want build shared lib embedded system has substitute lib. have tried build lib same symbols. when compare original lib mylib there slight difference. hence executable cannot find symbol in fake lib.
fake lib:
0000000000000c90 g df .text 0000000000000098 base dbus_pending_call_unref(dbuspendingcall*)
original lib:
0000000000020430 g df .text 0000000000000070 base dbus_pending_call_unref
as can see parameter of function not visible in original lib. reason why executable cannot find symbol? how can make parameter in symbol invisible fake lib?
i used objdump -tc see symbols , within src-file have used cmake export header export symbol.
you pointed solution adding extern "c"
, context, here's answer:
c++ allows functions overloaded depending on input parameters, instance following 2 functions can defined separately:
void foo(char *bar); void foo(const char *bar);
for work, need make sure these symbols different, symbol name "mangled", encode parameters part of symbol name. on modern linux (and other modern unices) convention mangling itanium convention starts _z
. c++filt
software can used encode/decode these mangled symbols human readable.
c, instead, not support overloading of functions, sole function name (and not parameters) part of symbol name.
Comments
Post a Comment