Hi everyone,
I am building my dylib with two-level namespace and I am using nm tool to inspect external symbols in the resulting dylib. I see the following list:
nm -m ./foo1/libfoo1.dylib | c++filt
(undefined) external std::terminate() (from libc++)
0000000000008080 (__DATA_CONST,__const) external typeinfo for foo::Base
0000000000008090 (__DATA_CONST,__const) external typeinfo for foo::Inherited
...
I see that std::terminate will only be taken from libc++ at the runtime. But it confuses me that I dont see any "from" statement for typeinfos.
The question is: Is it possible for ld to replace definition of these typeinfos with other definition provided by another library, or will libfoo1 always use its own definitions of typeinfo symbols?
I am asking because in -flat_namespace mode definitions with the same symbol name are merged between multiple dylibs, and I get one instance of typeinfo for each class in my process. I wonder if I can achieve this with two-level namespace.