comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Compiling C and Ada sources together
Date: 10 Aug 2001 05:43:21 +0100
Date: 2001-08-10T04:43:21+00:00	[thread overview]
Message-ID: <x7v66bwtthy.fsf@smaug.pushface.org> (raw)
In-Reply-To: Pine.LNX.4.33.0108091308240.130-100000@2067.resnet.uni.edu

<lange92@2067.resnet.uni.edu> writes:

>   I've been working on a project where we compile C source files and
> Ada sources together to produce a single binary. Most of it is
> automated at this point, but for debugging reasons I need to know
> how to do it by hand.  A long time ago, I saw an article (I thought
> it was on www.adahome.com) about how to link together sources from
> each language, particularly in the case where the C program makes
> calls to the ada source (the main program is in C) so the
> Interfaces.C functionality is not used.

If you're going to call Ada from C, you need to use pragma Export --
and it's best to be simple at this interface! (just simple types).

  function Foo (X : Integer) return Boolean;
  pragma Export (C, Foo, "package_foo");

(I'm not sure whether all compilers are clever enough to set all
Interfaces.C.int'Size bits of the Boolean result before returning it!)



      parent reply	other threads:[~2001-08-10  4:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-09 18:29 Compiling C and Ada sources together lange92
2001-08-10  2:17 ` Larry Kilgallen
2001-08-10  4:43 ` Simon Wright [this message]
replies disabled

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