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,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc23fdf9fe2f2080,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-28 07:28:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.rediris.es!news.uv.es!news.upv.es!not-for-mail From: "Pedro Jose Garcia Gil" Newsgroups: comp.lang.ada Subject: Interfacing a subprogram from C. Date: Thu, 28 Feb 2002 16:11:46 +0100 Organization: Universidad Politecnica de Valencia Message-ID: Reply-To: "Pedro Jose Garcia Gil" NNTP-Posting-Host: pggil.isa.upv.es X-Trace: polaris.cc.upv.es 1014909140 7146 158.42.16.82 (28 Feb 2002 15:12:20 GMT) X-Complaints-To: newsmaster@upv.es NNTP-Posting-Date: 28 Feb 2002 15:12:20 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:20574 Date: 2002-02-28T15:12:20+00:00 List-Id: Hello. I want to use a function in C to program in Ada95. For example (I have included all the realized steps.): %%%%%%%%%%%% file "pepe.c" %%%%% #include void pintar(int a){ printf("The number is : %d \n",a); } %%%%%%%%%%%% $gcc -c pepe.c %%%%%%%%%%% file prueba.adb %%% with Ada.Text_IO; use Ada.Text_IO; procedure prueba is pragma linker_options("prueba.o"); procedure pintar(dato: integer); pragma import(C,pintar,"pintar"); a: integer:=7; begin pintar(a); end prueba; %%%%%%%%%%%%%% $gnatmake prueba.adb >>>>>>>>>>>>>>>>>>>>>>>>> gnatbind -x prueba.ali gnatlink prueba.ali prueba.o: In function `_ada_prueba': prueba.o(.text+0x0): multiple definition of `_ada_prueba' ./prueba.o(.text+0x0): first defined here ./prueba.o: In function `_ada_prueba': ./prueba.o(.text+0x10): undefined reference to `pintar' prueba.o: In function `_ada_prueba': prueba.o(.text+0x10): undefined reference to `pintar' gnatmake: *** link failed. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> What am I doing wrong?. It's necessary to compile with other options or include some file in somewhere?. Thank you very much. Pedro.