This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
CNI & Exception handling
- From: Andrew Haley <aph at redhat dot com>
- To: "RamrajPrabu Balasubramanian" <ramrajprabu at hotmail dot com>
- Cc: java at gcc dot gnu dot org
- Date: Mon, 23 Aug 2004 19:23:48 +0100
- Subject: CNI & Exception handling
- References: <BAY8-F31mpgCQXmBRhr0000c1e8@hotmail.com>
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.