如果您编译此文件p3.cxx:
class foobarclass
{
public:
int i0;
};
void otherfun(void);
void mumble(void);
void fun(void)
{
try {
otherfun();
} catch(foobarclass &e) {
mumble();
}
}
Run Code Online (Sandbox Code Playgroud)
像这样:
xcrun clang++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -fexceptions -c p3.cxx -p3.64.o
Run Code Online (Sandbox Code Playgroud)
和
xcrun clang++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -fexceptions -c p3.cxx -o p3.32.o
Run Code Online (Sandbox Code Playgroud)
然后检查"typeinfo for foobarclass"的符号:
nm -m p3.64.o|grep ZTI
0000000000000110 (__DATA,__datacoal_nt) weak private external __ZTI11foobarclass
nm -m p3.32.o|grep ZTI
00000134 (__DATA,__datacoal_nt) weak external __ZTI11foobarclass
Run Code Online (Sandbox Code Playgroud)
为什么arm64中的符号弱私有外部?这意味着dlsym()将无法在运行时找到它.这打破了LibreOffice代码库中的某些低级内容.