views:

115

answers:

1

Hello,

I am embedding a c++ library (binding done with SIP) in my python application. Under certain circonstances (error cases), this library uses exit(), which causes my entire application to exit. Is there a way to catch this event, or do I need to modify the library to handle error cases differently ?

Thank you very much,

+2  A: 

You must modify the source of the library. There is no "exception handling" in C and exit() does not return to the calling code under any circumstances.

Aaron Digulla
+1. For some cases `atexit()` may help, but not if one needs to return to the calling code.
gimpf
Thank you, no I am sure of what I have to do ! Rgds,
CMO