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,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-20 16:20:51 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news2.telebyte.nl!teleglobe.net!teleglobe.net!62.81.31.29.MISMATCH!cyclone.auna.com!news-feeder.eresmas.com!garse!news.iddeo.es!not-for-mail From: =?iso-8859-1?q?Antonio_Mart=EDnez?= Newsgroups: comp.lang.ada Subject: Interfacing C and Ada95 Date: Tue, 21 Oct 2003 01:13:14 +0200 Organization: Iddeo - Retevisi�n Message-ID: NNTP-Posting-Host: 62.83.182.64 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity. (Debian GNU/Linux)) Xref: archiver1.google.com comp.lang.ada:1230 Date: 2003-10-21T01:13:14+02:00 List-Id: 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() { int i = 3; printf("%i + 2 = %i\n", i, masdos(3)); 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