comp.lang.ada
 help / color / mirror / Atom feed
* What happens to Ada exceptions if c calls ada
@ 2001-07-02  8:33 Mark Doherty
  2001-07-02 11:15 ` Larry Kilgallen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mark Doherty @ 2001-07-02  8:33 UTC (permalink / raw)


I am writing a mixed language application (not by choice).

I have an Ada main program calling c routines that in turn calling an
Ada device driver.

What happens if the device driver raises an exception?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: What happens to Ada exceptions if c calls ada
  2001-07-02  8:33 What happens to Ada exceptions if c calls ada Mark Doherty
@ 2001-07-02 11:15 ` Larry Kilgallen
  2001-07-02 11:32 ` Lars Troppen
  2001-07-02 12:38 ` Marc A. Criley
  2 siblings, 0 replies; 5+ messages in thread
From: Larry Kilgallen @ 2001-07-02 11:15 UTC (permalink / raw)


In article <2d87db3f.0107020033.5f0d19d0@posting.google.com>, Mark.Doherty@uk.thalesgroup.com (Mark Doherty) writes:
> I am writing a mixed language application (not by choice).
> 
> I have an Ada main program calling c routines that in turn calling an
> Ada device driver.
> 
> What happens if the device driver raises an exception?

On VMS (and a couple of other operating systems, I believe) the exception
would be handled in Kernel mode while all "main programs" are in user mode.

You really need to tell us what operating system you are using (unless
you don't really mean "device driver").



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: What happens to Ada exceptions if c calls ada
  2001-07-02  8:33 What happens to Ada exceptions if c calls ada Mark Doherty
  2001-07-02 11:15 ` Larry Kilgallen
@ 2001-07-02 11:32 ` Lars Troppen
  2001-07-02 20:05   ` tmoran
  2001-07-02 12:38 ` Marc A. Criley
  2 siblings, 1 reply; 5+ messages in thread
From: Lars Troppen @ 2001-07-02 11:32 UTC (permalink / raw)


Mark.Doherty@uk.thalesgroup.com (Mark Doherty) writes:

> I am writing a mixed language application (not by choice).
> 
> I have an Ada main program calling c routines that in turn calling an
> Ada device driver.
> 
> What happens if the device driver raises an exception?

From my experience the exception will be propagated up to 
the first block that contains an exception handler. So 
your C code will never see the exceptions (natually).

If your c code has problems with this you have to make sure
that all exceptions are trapped in the device driver and converted
to return codes that C will understand.

Lars Troppen, Dept DC4S, Kongsberg Defence & Aerospace
PO 1003, N3601 Kongsberg, Norway
Tel: (+47) 32288722 Mail: lars.g.troppen@kongsberg.com




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: What happens to Ada exceptions if c calls ada
  2001-07-02  8:33 What happens to Ada exceptions if c calls ada Mark Doherty
  2001-07-02 11:15 ` Larry Kilgallen
  2001-07-02 11:32 ` Lars Troppen
@ 2001-07-02 12:38 ` Marc A. Criley
  2 siblings, 0 replies; 5+ messages in thread
From: Marc A. Criley @ 2001-07-02 12:38 UTC (permalink / raw)


Mark Doherty wrote:
> 
> I am writing a mixed language application (not by choice).
> 
> I have an Ada main program calling c routines that in turn calling an
> Ada device driver.
> 
> What happens if the device driver raises an exception?

I would never rely on any kind of inter-language exception
passing/handling without iron-clad guarantees from the compiler vendors.

In this kind of situation I would put a thin wrapper around the device
driver to catch the exceptions and convert them into something that C
would find tolerable, such as return codes.

Marc A. Criley
Senior Staff Engineer
Quadrus Corporation
www.quadruscorp.com



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: What happens to Ada exceptions if c calls ada
  2001-07-02 11:32 ` Lars Troppen
@ 2001-07-02 20:05   ` tmoran
  0 siblings, 0 replies; 5+ messages in thread
From: tmoran @ 2001-07-02 20:05 UTC (permalink / raw)


>From my experience the exception will be propagated up to
>the first block that contains an exception handler. So
>your C code will never see the exceptions (natually).
  That accords with my (limited) experience also.  If the C
run-time doesn't have any hidden data structures, only frames on
the stack, and there are no pointers into the stack area that is
going to be cut away, then having the Ada run-time cut back the
stack should be OK, ie, it should leave things as if the C stuff
was never called.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-07-02 20:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-02  8:33 What happens to Ada exceptions if c calls ada Mark Doherty
2001-07-02 11:15 ` Larry Kilgallen
2001-07-02 11:32 ` Lars Troppen
2001-07-02 20:05   ` tmoran
2001-07-02 12:38 ` Marc A. Criley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox