c exception between libraries - Serbipunk/notes GitHub Wiki
https://program-think.blogspot.com/2009/01/cxx-cross-platform-develop-3-exception.html
在c++03没有abi标准,所以跨库的异常要慎用!(https://www.zhihu.com/question/39148567)
https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
https://blog.csdn.net/wpc320/article/details/8424956
-shared-libgcc 和 -static-libgcc
On systems that provide libgcc as a shared library, these options force the use of either the shared or static version, respectively.
在将libgcc作为共享(动态)库的系统中,这个选项强制要求使用libgcc的共享或者静态版本
If no shared version of libgcc was built when the compiler was configured, these options have no effect.
如果没有共享(动态)版本的libgcc,这个选项木有作用。
There are several situations in which an application should use the shared libgcc instead of the static version.
有一些情况,非使用共享(动态)版的libgcc不可。
The most common of these is when the application wishes to throw and catch exceptions across different shared libraries.
最常见的情况是程序想在共享(动态)多个库之间抛出、捕获异常。
In that case, each of the libraries as well as the **application itself** should use the shared libgcc.
这种情况下,每个库,以及**调用库的程序**必须使用动态的libgcc。
Therefore, the G++ driver automatically adds -shared-libgcc whenever you build a shared library or a main executable, because C++ programs typically use exceptions, so this is the right thing to do.
If, instead, you use the GCC driver to create shared libraries, you may find that they are not always linked with the shared libgcc. If GCC finds, at its configuration time, that you have a non-GNU linker or a GNU linker that does not support option --eh-frame-hdr, it links the shared version of libgcc into shared libraries by default. Otherwise, it takes advantage of the linker and optimizes away the linking with the shared version of libgcc, linking with the static version of libgcc by default. This allows exceptions to propagate through such shared libraries, without incurring relocation costs at library load time.
However, if a library or main executable is supposed to throw or catch exceptions, you must link it using the G++ driver, or using the option -shared-libgcc, such that it is linked with the shared libgcc.