digitalmars.D.learn - Catch exception from external library
- Callum Anderson <callumenator gmail.com> Aug 10 2011
- Jonathan M Davis <jmdavisProg gmx.com> Aug 11 2011
- Callum Anderson <callumenator gmail.com> Aug 11 2011
- Callum Anderson <callumenator gmail.com> Aug 11 2011
- Jonathan M Davis <jmdavisProg gmx.com> Aug 11 2011
- Russel Winder <russel russel.org.uk> Aug 11 2011
Hi, Is there any way to catch unhandled exceptions thrown by external libraries? I am calling an external C library function, which works fine in release mode, however in debug mode it throws a SIGSEV. I would like to debug later parts of the code, but can;t get past this function when debugging because of the exception. I have tried putting the function call in try/catch, tried a scope(failure) and tried collectException() from std.exception. Is it possible to catch these exceptions? Thanks alot, Callum
Aug 10 2011
On Thursday, August 11, 2011 06:53:57 Callum Anderson wrote:Hi, Is there any way to catch unhandled exceptions thrown by external libraries? I am calling an external C library function, which works fine in release mode, however in debug mode it throws a SIGSEV. I would like to debug later parts of the code, but can;t get past this function when debugging because of the exception. I have tried putting the function call in try/catch, tried a scope(failure) and tried collectException() from std.exception. Is it possible to catch these exceptions?
SIGSEV is a signal, not an exception. No exception handling code will do anything with it. And pure c code _can't_ throw exceptions of any kind, because C has no exceptions (it _might_ be possible for an exception to come out of C code which called code from another language which _does_ have ecxeptions, but I'm not sure). If you want to handle SIGSEGV, you need a use a signal handler. - Jonathan M Davis
Aug 11 2011
Thanks, SIGSEGV was a brain malfunction on my part sorry. The error was SIG Unhandled Exception. And I should have said I was calling a C-Api layer on a C++ library. Does that change anything? Thanks again, Callum
Aug 11 2011
Ok thanks for the help, wasn't sure if I was missing something obvious. Cheers, Callum
Aug 11 2011
On Thursday, August 11, 2011 07:29:35 Callum Anderson wrote:Thanks, SIGSEGV was a brain malfunction on my part sorry. The error was SIG Unhandled Exception. And I should have said I was calling a C-Api layer on a C++ library. Does that change anything? Thanks again, Callum
I really don't know what happens with C++ exceptions that get thrown when the C++ is wrapped in a C API. So, I can't really help you there. The best that I could do is google for it. - Jonathan M Davis
Aug 11 2011
Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2011-08-11 at 00:42 -0700, Jonathan M Davis wrote:On Thursday, August 11, 2011 07:29:35 Callum Anderson wrote:Thanks, SIGSEGV was a brain malfunction on my part sorry. The error was SIG Unhandled Exception. And I should have said I was calling a C-Api layer=
a C++ library. Does that change anything? Thanks again, Callum
I really don't know what happens with C++ exceptions that get thrown when=
C++ is wrapped in a C API. So, I can't really help you there. The best th=
could do is google for it.
Join ACCU http://accu.org. Get on their general mailing list. Ask there, and you'll either get an answer immediately or an answer will emerge from the ensuing debate. ACCU has a high percentage of very highly knowledgeable and skilled C++ folk, including lots of people on the standards committees. ACCU also has Java, C#, Python, agile process, etc. folk and activity, but given it is an organization originally created from a merge of the C User Group, and the European C++ user Group . . . --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Aug 11 2011









Callum Anderson <callumenator gmail.com> 