This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: CNI compile error


On 26 Jun 2001 07:36:51 -0500, I wrote:
> 
> While compiling the CNI samples linked from here:
> http://gcc.gnu.org/java/cni-1.txt, I encountered this compile time
> error:
> 
> [weiqi@gao cni]$ gcj -I/opt/gcc-3.0/include -c sampNat.cc 
> /opt/gcc-3.0/include/g++-v3/bits/ostream.tcc: In function 
>    `std::basic_ostream<char, _Traits>&
> std::operator<<(std::basic_ostream<char,    _Traits>&, const char*)
> [with _Traits = std::char_traits<char>]':
> sampNat.cc:11:   instantiated from here
> /opt/gcc-3.0/include/g++-v3/bits/ostream.tcc:708: mixing C++ and Java
> catches 
>    in a single translation unit
> 
> Any hints?

Never mind.

The GCC 3.0 manual answered my question, "You cannot mix Java and C++
exceptions in the same translation unit."[1]

[1] Richard Stallman, Using and Porting the GNU Compiler Collection,
FSF, Boston, 14-June-2001, p.206

The sample needs to be fixed, then.

I'm still trying to see what practical limitations this imposes on
writing native methods.  Is the following a fair accessment?:

+ No C++ classes that throws or catches (C++) exceptions (e.g.,
std::cout) can be used in CNI/JNI native methods.

-- 
Weiqi Gao
weiqigao@networkusa.net


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]