Article View: comp.sys.mac.programmer.codewarrior
Article #989Re: CW7.2 and jnilib and C++ Exception woes
From: Leon
Date: Fri, 03 May 2002 19:44
Date: Fri, 03 May 2002 19:44
73 lines
3307 bytes
3307 bytes
Here is the HelloWorld example that I modified to demonstrate my problem.
The project contains a target called HelloWorld_MACH that I added to produce
libHelloWorld.jnilib for MacOSX. Perhaps I goofed on the settings, that's
why it's causing exceptions to crash.
Download it at
http:\\www.lifeforms.com\helpme\JNI example.sit
--
Remove the underscores to reply to me.
l_e_o_n @ c_h_a_r_a_c_t_e_r_m_o_t_i_o_n . c_o_m
"Leon" <l_e_o_n@charactermotion.com> wrote in message
news:S2Yz8.3742$5X6.106437@news0.telusplanet.net...
> How come C++ exceptions do not work on MacOSX with a CW7.2 compiled
> jnilib???
>
> As a simple test, I modified the included HelloWorld JNI example, located
in
> the (Codewarrior Examples):CodeWarrior Java:Metrowerks Sample
> Projects:Native examples:JNI example:Sources folder to create a JNILIB
> (convert to Mach-O bundle target), and added the following method:
>
> class A() {};
>
> JNIEXPORT void JNICALL Java_com_mw_example_HelloWorld_throwMethod
> (JNIEnv *env, jobject obj)
> {
> try
> {
> throw A();
> }
> catch (...)
> {
> printf("Caught!\n");
> };
> }
>
> Of course, changes were also made in HelloWorld.java and
TestHelloWorld.java
> to reflect the new method.
>
> The example works as it should calling each native function, but when it
> calls throwMethod(), it crashes (segmentation fault). Upon further
> inspection with GDB, it reported the following:
>
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> ExPPC_FindExceptionRecord (returnaddr=0x15ac7b0 "H", info=0xbfffe88c) at
> ExceptionPPC.cp:874
> 874 if ((returnaddr >= (char *) p->functionaddr)
>
>
> What's going? Do I need to register my exception or something??
>
> I've updated my Universal Headers and have recompiled all the MetroWerk
> related projects (precompiled headers, MSL runtimes, MSL C++, etc...).
>
> Could anyone verify that this indeed is a problem or is there something
> wrong with my Mac...
>
> --
> Remove the underscores to reply to me.
> l_e_o_n @ c_h_a_r_a_c_t_e_r_m_o_t_i_o_n . c_o_m
>
>
>
>
>
>
Technical Details
Message-ID:
<CMBA8.10484$5X6.299348@news0.telusplanet.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sunqbc.risq.qc.ca!newsfeed.telusplanet.net!news0.telusplanet.net.POSTED!53ab2750!not-for-mailReferences:
<S2Yz8.3742$5X6.106437@news0.telusplanet.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10bcce,8001f03ae149be7a X-Google-Attributes: gid10bcce,public X-Google-Thread: f635e,8001f03ae149be7a X-Google-Attributes: gidf635e,public X-Google-ArrivalTime: 2002-05-03 12:44:34 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sunqbc.risq.qc.ca!newsfeed.telusplanet.net!news0.telusplanet.net.POSTED!53ab2750!not-for-mail From: "Leon" <l_e_o_n@charactermotion.com> Newsgroups: comp.sys.mac.programmer.codewarrior,codewarrior.mac References: <S2Yz8.3742$5X6.106437@news0.telusplanet.net> Subject: Re: CW7.2 and jnilib and C++ Exception woes Lines: 77 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <CMBA8.10484$5X6.299348@news0.telusplanet.net> Date: Fri, 03 May 2002 19:44:34 GMT NNTP-Posting-Host: 209.53.254.186 X-Trace: news0.telusplanet.net 1020455074 209.53.254.186 (Fri, 03 May 2002 13:44:34 MDT) NNTP-Posting-Date: Fri, 03 May 2002 13:44:34 MDT