From: mockturtle <framefritti@gmail.com>
Subject: Re: Ada file depends on C file
Date: Thu, 17 Sep 2009 10:35:07 -0700 (PDT)
Date: 2009-09-17T10:35:07-07:00 [thread overview]
Message-ID: <b92fbc38-9463-49ec-ae1a-30ff91217630@q14g2000vbi.googlegroups.com> (raw)
In-Reply-To: 1ti6i9vyr5k4x$.ynnox0weminr$.dlg@40tude.net
On Sep 17, 6:17 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Thu, 17 Sep 2009 07:49:46 -0700 (PDT), Ludovic Brenta wrote:
> > mockturtle wrote on comp.lang.ada:
> >> On Sep 17, 3:07 pm, Ludovic Brenta <ludo...@ludovic-brenta.org> wrote:
> >>> I normally use a Makefile to compile in such situations but there are
> >>> two alternatives: gprmake and its successor, gprbuild. In GPS, you can
> >>> specify that your project is multi-language; this will cause it to
> >>> call the proper tool (instead of gnatmake, which is for Ada-only
>
> >> I did. If I open with an editor the .gpr file created by GPS I find
> >> the line
>
> >> for Languages use ("Ada", "C");
>
> > From memory, this is necessary but not sufficient; you also have to
> > tick a check box somewhere to tell GPS that your project file is multi-
> > language. This is confusing, I know, and I learned the hard way :)
>
> Hmm, adding C files into the list of sources should suffice. For example,
> the following works for me:
>
> ------- mixed.gpr
> project Mixed is
> for Languages use ("Ada", "C");
> for Source_Dirs use (".");
> for Source_Files use ("main.adb", "c.c");
> for Main use ("main.adb");
> end Mixed;
> ------ main.adb
> with Ada.Text_IO; use Ada.Text_IO;
> with Interfaces.C; use Interfaces.C;
>
> procedure Main is
> function C return Int;
> pragma Import (C, C);
> begin
> Put_Line ("Value:" & Int'Image (C));
> end Main;
> ------ c.c
> int c (void)
> {
> return 123;}
>
> ----------------------------------------------
> This should compile under GPS and print
>
> Value: 123
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de
Thank you to everyone for your help. I just discovered that it is
maybe a problem with the old GPS version: I moved the complete
"packet" to a computer with GPS 4.3.1 (20090114) and everything worked
without changing a bit. Hmmm... I am afraid that I will need to
update the older GPS.
next prev parent reply other threads:[~2009-09-17 17:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-17 12:38 Ada file depends on C file mockturtle
2009-09-17 13:07 ` Ludovic Brenta
2009-09-17 13:32 ` mockturtle
2009-09-17 14:49 ` Ludovic Brenta
2009-09-17 16:17 ` Dmitry A. Kazakov
2009-09-17 17:35 ` mockturtle [this message]
2009-09-17 13:29 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox