comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: including C routines in Ada (newbie ask for assistance)
Date: 09 May 2001 06:39:34 +0100
Date: 2001-05-09T05:39:34+00:00	[thread overview]
Message-ID: <x7voft3dqsp.fsf@smaug.pushface.org> (raw)
In-Reply-To: 3af67ee5.9539925@news.nl.uu.net

serious@clerk.com (Noam Kloos) writes:

> Hi Once I had someone show me how to write routines in C and import
> them into Ada source with pragma Import(....);
> I know how to do a system call pragma import(C,C_System,"system"); but
> how do I access a c source file I have written myself?

For a start, you write similar pragma Imports for your own
functions. Then you have to link against the object files.

If you are using GNAT, and you have your main Ada program in foo.adb
and your C in bar.c, you would need

  gcc -c bar.c
  gnatmake foo -largs bar.o

(to start with, it can get more complicated of course!)



      parent reply	other threads:[~2001-05-09  5:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-07 10:57 including C routines in Ada (newbie ask for assistance) Noam Kloos
2001-05-07 13:01 ` Marc A. Criley
2001-05-07 14:00   ` Marin David Condic
2001-05-07 17:39     ` David Starner
2001-05-07 21:17       ` Marin David Condic
2001-05-09  5:39 ` 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