From: David Marceau <davidmarceau@sympatico.ca>
Subject: Re: Interfacing C and Ada95
Date: Mon, 20 Oct 2003 22:02:26 -0400
Date: 2003-10-20T22:02:26-04:00 [thread overview]
Message-ID: <3F9493B2.7CA65D9A@sympatico.ca> (raw)
In-Reply-To: pan.2003.10.20.23.13.08.847161@atc.ugr.es
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 <stdio.h>
> 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
next prev parent reply other threads:[~2003-10-21 2:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-20 23:13 Interfacing C and Ada95 Antonio Martínez
2003-10-21 2:02 ` David Marceau [this message]
2003-10-21 4:57 ` sk
2003-10-21 15:00 ` Stephen Leake
2003-10-21 22:16 ` Simon Wright
2003-10-21 16:04 ` Antonio Martínez
2003-10-21 17:26 ` sk
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox