Re: vc6 exceptions not caught by vs2005 by Ulrich
Ulrich
Mon Jun 25 01:58:33 CDT 2007
jrrtolkienfan@gmail.com wrote:
> My application has a small JNI piece written in C++. This piece was
> developed using VC++ 2k5. We statically link with some .lib's which
> were built using vc6. I see that exceptions thrown by some api's in
> these .lib's are not getting caught but are causing the app to crash.
std::exception is a different type when compiled with a different C++
compiler. In general, you can't mix code between different C++
implementations and VC6 and VS2005 count as such. The exception to that
rule is when you restrict yourself to a C interface, but that also means
that no exceptions are thrown across the function calls.
> When this code was "ported" to vc6 this wasn't observed. It so happens
> we also support HPUX n Solaris n it works fine there too.
Perhaps because you are not mixing compilers there, otherwise the same
problems occur there, too.
> Any workarounds?
Recompile all code with the same C++ compiler.
Uli