CNI & Exception handling
Bryce McKinlay
mckinlay@redhat.com
Mon Aug 23 22:19:00 GMT 2004
Andrew Haley wrote:
>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,
Do you have an idea of how difficult it would be to relax this
restriction? Would it be possible to, say, only allow one type of
exceptions to be *caught* in a given compilation unit? Or, could we make
libgcj's personality routine handle C++ exceptions as well (for CNI
code)? Currently, this does seem like a pretty nasty limitation for CNI.
Regards
Bryce
More information about the Java
mailing list