comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic.brenta@insalien.org>
Subject: Re: calling an ada procedure from C++
Date: 18 Nov 2003 01:03:39 +0100
Date: 2003-11-18T01:03:39+01:00	[thread overview]
Message-ID: <m38ymezgo4.fsf@insalien.org> (raw)
In-Reply-To: sr8ub.46021$bQ3.24980@nwrdny03.gnilink.net


I think some compilers will also return small structures in processor
registers.  They will neither use the stack not any static memory, if
they can help it.

The basic point remains: how each compiler passes structures between
efunctions is compiler-specific.  It is however possible, both in C
and in Ada, to specify the exact bit pattern for a stucture, and thus
to pass the structure back and forth.  I think the most portable way
would be to pass pointers to the structures (as earlier suggested) but
if the OT uses GNAT (where the compiler handles both C and Ada), there
may be more efficient ways using representation clauses and Pragma
Convention.

BTW, C++ is a different beast altogether.  I would avoid it if
possible, especially if the C++ struct is really a class with methods
and parents or descendants.  Better stick with a strictly C struct.

My 2 cents.

-- 
Ludovic Brenta.



  reply	other threads:[~2003-11-18  0:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-12 15:11 calling an ada procedure from C++ Anthony Moss
2003-11-17  4:04 ` red floyd
2003-11-17  7:37 ` tmoran
2003-11-17 10:38 ` Duncan Sands
2003-11-17 14:32   ` Hyman Rosen
2003-11-17 18:28     ` Frank J. Lhota
2003-11-18  0:03       ` Ludovic Brenta [this message]
2003-11-18  0:32         ` Frank J. Lhota
2003-11-22  5:25           ` Dave Thompson
2003-11-17 21:13 ` sk
replies disabled

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