🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.programmer.codewarrior
Article #1011

CW7.2 and jnilib and C++ Exception woes

#1011
From: Leon
Date: Wed, 01 May 2002 20:16
47 lines
2650 bytes
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: <S2Yz8.3742$5X6.106437@news0.telusplanet.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!news.airnews.net!cabal11.airnews.net!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cyclone.bc.net!newsfeed.telusplanet.net!news0.telusplanet.net.POSTED!53ab2750!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bcce,8001f03ae149be7a,start
X-Google-Attributes: gid10bcce,public
X-Google-Thread: f635e,8001f03ae149be7a,start
X-Google-Attributes: gidf635e,public
X-Google-ArrivalTime: 2002-05-01 13:16:51 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!news.airnews.net!cabal11.airnews.net!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cyclone.bc.net!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
Subject: CW7.2 and jnilib and C++ Exception woes
Lines: 53
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: <S2Yz8.3742$5X6.106437@news0.telusplanet.net>
Date: Wed, 01 May 2002 20:16:50 GMT
NNTP-Posting-Host: 209.53.254.186
X-Trace: news0.telusplanet.net 1020284210 209.53.254.186 (Wed, 01 May 2002 14:16:50 MDT)
NNTP-Posting-Date: Wed, 01 May 2002 14:16:50 MDT