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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,76f120be5d26bfd8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-20 19:26:53 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!snoopy.risq.qc.ca!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Message-ID: <3F9493B2.7CA65D9A@sympatico.ca> From: David Marceau X-Mailer: Mozilla 4.79 [en] (X11; U; Linux 2.4.17-10mdksmp i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Interfacing C and Ada95 References: Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Mon, 20 Oct 2003 22:02:26 -0400 NNTP-Posting-Host: 65.92.163.231 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1066702292 65.92.163.231 (Mon, 20 Oct 2003 22:11:32 EDT) NNTP-Posting-Date: Mon, 20 Oct 2003 22:11:32 EDT Organization: Bell Sympatico Xref: archiver1.google.com comp.lang.ada:1242 Date: 2003-10-20T22:02:26-04:00 List-Id: Antonio Mart�nez wrote: > > Hello group. > > I'm trying to interface C and Ada95 using gcc and gnat. The question is, > Why I cannot use put_line in my function sumtwo ? > > I have this 3 sources (these are very small...) > > paquete.ads: > package Paquete is > function sumtwo(X : in Integer) return Integer; > pragma Export_Function(Internal=>sumtwo, External=>sumtwo); > end Paquete; > > paquete.adb: > with Ada.Text_io; use Ada.Text_Io; > package body Paquete is > function sumtwo(X : in Integer) return Integer is > begin > -- put_line("Hello"); > return X + 2; > end sumtwo; > end Paquete; > > progC.c: > > #include > int sumtwo(); > int main() { adainit(); > int i = 3; > printf("%i + 2 = %i\n", i, masdos(3)); adafinal(); > return 0; > } > > Ok... now I compile like this: > > gnatmake paquete.adb -> generates paquete.ali & paquete.o > gcc progC.v paquete.o -o progC -> generates progC executable > > and it works !!!! Ok. Now, if I add the 5th line in the file > paquete.adb, which contains put_line("Hello"), the gcc says ... > paquete.o(.text+0x10): In function `sumtwo': > > : referencia a `ada__text_io__put_line__2' sin definir > collect2: ld devolvi� el estado de salida 1 > > What is the problem? Do I have to export Ada.Text_IO in any matter? > > Thank you. > > -- > Antonio Mart�nez