From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,7c6bcf9f4b4496b1 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!q14g2000vbi.googlegroups.com!not-for-mail From: mockturtle Newsgroups: comp.lang.ada Subject: Re: Ada file depends on C file Date: Thu, 17 Sep 2009 10:35:07 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <87bfc895-8c74-4fe9-86b6-99416006ab65@z34g2000vbl.googlegroups.com> <4205125b-ccae-4ec0-894f-c53976ecca7c@p23g2000vbl.googlegroups.com> <0d986b0b-ec32-4dec-980e-471d210aa6d4@o13g2000vbl.googlegroups.com> <64e357f1-367d-4791-9307-49e8cc678c18@p36g2000vbn.googlegroups.com> <1ti6i9vyr5k4x$.ynnox0weminr$.dlg@40tude.net> NNTP-Posting-Host: 93.37.251.179 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1253208908 12506 127.0.0.1 (17 Sep 2009 17:35:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 17 Sep 2009 17:35:08 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: q14g2000vbi.googlegroups.com; posting-host=93.37.251.179; posting-account=9fwclgkAAAD6oQ5usUYhee1l39geVY99 User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.64 (X11; Linux i686; U; en) Presto/2.1.1,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8371 Date: 2009-09-17T10:35:07-07:00 List-Id: On Sep 17, 6:17=A0pm, "Dmitry A. Kazakov" 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=A0pm, Ludovic Brenta wrot= e: > >>> I normally use a Makefile to compile in such situations but there are > >>> two alternatives: gprmake and its successor, gprbuild. In GPS, you ca= n > >>> 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. =A0If I open with an editor the .gpr file created by GPS I find > >> the line > > >> =A0 =A0for 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 > =A0 =A0for Languages use ("Ada", "C"); > =A0 =A0for Source_Dirs use ("."); > =A0 =A0for Source_Files use ("main.adb", "c.c"); > =A0 =A0for Main use ("main.adb"); > end Mixed; > ------ main.adb > with Ada.Text_IO; =A0 use Ada.Text_IO; > with Interfaces.C; =A0use Interfaces.C; > > procedure Main is > =A0 =A0function C return Int; > =A0 =A0pragma Import (C, C); > begin > =A0 =A0Put_Line ("Value:" & Int'Image (C)); > end Main; > ------ c.c > int c (void) > { > =A0 =A0return 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.