From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,648d77c9ea27b233 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-16 13:11:55 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!feed2.onemain.com!feed1.onemain.com!uunet!dca.uu.net!ash.uu.net!xyzzy!nntp From: "Dale Pennington" Subject: Re: Catching Ada exceptions in C on an SGI X-Nntp-Posting-Host: e264771.se.nos.boeing.com Message-ID: X-Mimeole: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Priority: 3 X-Msmail-Priority: Normal Sender: nntp@news.boeing.com (Boeing NNTP News Access) Organization: The Boeing Company X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 References: <86g08jwhdy.fsf@mihalis.net> Date: Tue, 16 Oct 2001 20:01:16 GMT Xref: archiver1.google.com comp.lang.ada:14743 Date: 2001-10-16T20:01:16+00:00 List-Id: "Chris Morgan" wrote in message news:86g08jwhdy.fsf@mihalis.net... > "Dale Pennington" writes: > > > Situation is as follows : A third party is supplying us a library in Ada > > with C entry (i.e. pragma export). The library is build with GNAT 3.13a on > > SGI Irix 6.5. Unfortunately, while they supply C entries, these entries do > > not trap any Ada exceptions raised, so if an exception occurs, our program > > (written in C) crashes. It is not feasible to detect the conditions that > > would raise an exception before the Ada calls, and we are not sure how long > > it will take the third party to fix thing (or even if they will). > > > > In the interim, we would like to somehow catch the Ada exceptions in out C > > code. I was wondering if anyone had done work before on this problem, or had > > good pointer on where I could look. > > Wrap the functions in Ada, catch exceptions in the wrappers, and call > them from C. I think that may be where I am heading, as I cannot do it in C and C++ (I have tried with no success). Of course this means convincing my boss to let me load GNAT onto our development machine, which will take some work (he is a C person). One thing I would like to check. The current Ada library already exports adainit and adafinal. So this new wrapped library obviously cannot use the same symbols for its init and final. Would the method be to run the bind function, then edit the result .ads and .adb for my own name before gnatmakeing and linking it ? Thanks, Dale