CNI & Exception handling

Andrew Haley aph@redhat.com
Mon Aug 23 18:41:00 GMT 2004


RamrajPrabu Balasubramanian writes:
 > Hi,
 >       The project I'm working on involves writing CNI wrappers to existing 
 > c++ classes that we have. the problem is these c++ classes throw exceptions 
 > and there are a lot of them. I know catching c++ exceptions and rethrowing 
 > them as java exceptions casuses the " mixing java and c++ exceptions in same 
 > translation unit is not  allowed" error.
 >       Getting past this hurdle is very important for us to adopt gcj in our 
 > projects, can some one suggest some ways to handle these c++ exceptions 
 > without changing our existing c++ code ?

The obvious solution is to have a layer that catches C++ exceptions
and returns appropriate flags.  Another layer, separately compiled,
can throw Java exceptions.

Andrew.



More information about the Java mailing list