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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,502445566010c6a0 X-Google-Attributes: gid103376,public From: Laurent Guerby Subject: Re: HELP! C++ exceptions SunOS Date: 1997/12/19 Message-ID: <199712191141.MAA16696@oslo.act-europe.fr>#1/1 X-Deja-AN: 308549264 References: <349989C3.35F6@ibm.net> X-Mail2News-User: guerby@oslo.act-europe.fr X-Complaints-To: abuse@demon.net X-Mail2News-Path: oslo.act-europe.fr X-Trace: mail2news.demon.co.uk 882531754 21628 guerby oslo.act-europe.fr Reply-To: guerby@gnat.com Newsgroups: comp.lang.ada Date: 1997-12-19T00:00:00+00:00 List-Id: > NOW, I have a main program calling func1(). When the main is in C++, > everything is ok, func1 catches the exception and prints the message. > However, when the main is in ada, the libC.a prints an error and aborts > the program, saying something about no exception handler. > > My guess is that there is some code running in the C++ version BEFORE > the main(), perhaps something that comes from crt?.o that the linker > puts in automatically, but what? and how does it work? and most > important - how do a simulate it for a program who's main is in ada? You can't because (I think, glad to be wrong here) there is nothing in the C++ standard like 'adainit' and 'adafinal' for Ada 95 (the Ada 95 designers thought about foreign languages). If you have C++ around, the main must be in C++ so that the C++ run-time is initialized, as you guessed. I've done the kind of thing you describe using GNAT and Sun C++ compiler, as long as C++ catches its own exceptions, it works fine. Just write a dummy main in C++ that calls adainit, the main Ada procedure (put an pragma Export (C, ...) on it in the Ada code) and then adafinal. It'll work. -- Laurent Guerby , Team Ada. "Use the Source, Luke. The Source will be with you, always (GPL)."