comp.lang.ada
 help / color / mirror / Atom feed
* Compiling C and Ada sources together
@ 2001-08-09 18:29 lange92
  2001-08-10  2:17 ` Larry Kilgallen
  2001-08-10  4:43 ` Simon Wright
  0 siblings, 2 replies; 3+ messages in thread
From: lange92 @ 2001-08-09 18:29 UTC (permalink / raw)


Hi all,
  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.

  Anyone else seen the article, or know how it's done? I'm been perusing
the grant_ug.html without much success.

Thanks
DanL




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

* Re: Compiling C and Ada sources together
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Larry Kilgallen @ 2001-08-10  2:17 UTC (permalink / raw)


In article <Pine.LNX.4.33.0108091308240.130-100000@2067.resnet.uni.edu>, <lange92@2067.resnet.uni.edu> writes:
> Hi all,
>   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.
> 
>   Anyone else seen the article, or know how it's done? I'm been perusing
> the grant_ug.html without much success.

Any approach that does not use Interfaces.C is likely to be specific
to a particular compiler and operating system, so you better specify
yours before you start getting lots of correct but non-applicable answers.



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

* Re: Compiling C and Ada sources together
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Wright @ 2001-08-10  4:43 UTC (permalink / raw)


<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!)



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

end of thread, other threads:[~2001-08-10  4:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox