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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC 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!news4.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!noris.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada file depends on C file Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH 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> Date: Thu, 17 Sep 2009 18:17:47 +0200 Message-ID: <1ti6i9vyr5k4x$.ynnox0weminr$.dlg@40tude.net> NNTP-Posting-Date: 17 Sep 2009 18:17:43 CEST NNTP-Posting-Host: 749b217a.newsspool1.arcor-online.net X-Trace: DXC=J19Gh\G^>i`[F<50eo:0knic==]BZ:afn4Fo<]lROoRa^YC2XCjHcbiCfe5QI_]=OiDNcfSJ;bb[eIRnRBaCd 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 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. Kazakov http://www.dmitry-kazakov.de