G ++ problem: there was no exception

The situation is that I have a dynamic library written in C ++ that is wrapped for Python with another dynamic library also written in C ++ (generated by SIP to be specific). The first dynamic library defines a function do_raisethat throws an exception RaiserError, a subclass std::exception. The second dynamic library, in a wrapper do_raise, tries to catch RaiserErrorin order to translate it into a Python exception.

Building with Visual C ++, everything works as expected and is RaiserErrorcaught correctly. However, using g ++ on Linux is RaiserErrornot caught. If I try to catch std::exceptioninstead ( RaiserErrorbaseclass), it will work. What is wrong here? Do the two libraries have different type concepts RaiserErrorsince they are not recognized by the catch block?

For testing, I also write a small executable that calls do_raisein the C ++ library, and here I can catch RaiserErroreven with g ++.

+3
source share
4 answers

++ . Windows ( 32- ) ABI, gcc .

+3

, GCC - , , .

, Microsoft ++ (, ). GCC.

, info ELF.so. , .so.

Edit: : , ELF typeinfo . , , - -Bsymbolic .so .

+2

, .so, , .

-, , , - : , , , / , g++ , . , , .

+1

( ) RTTI .so.

-Wl, -E , .

V++ ( ) ( , catching ..), , dll (- RTTI, dll).

, ( ABI, g++ >= 4.3).

0

Source: https://habr.com/ru/post/1718255/


All Articles