* Re: HELP! C++ exceptions SunOS
[not found] <349989C3.35F6@ibm.net>
@ 1997-12-19 0:00 ` Laurent Guerby
0 siblings, 0 replies; only message in thread
From: Laurent Guerby @ 1997-12-19 0:00 UTC (permalink / raw)
> 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 <guerby@gnat.com>, Team Ada.
"Use the Source, Luke. The Source will be with you, always (GPL)."
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1997-12-19 0:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <349989C3.35F6@ibm.net>
1997-12-19 0:00 ` HELP! C++ exceptions SunOS Laurent Guerby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox