From: mcragg@gmu90x.UUCP (Maureen Cragg)
Subject: calling ada from c
Date: 16 Oct 88 00:23:42 GMT [thread overview]
Message-ID: <1512@gmu90x.UUCP> (raw)
i have successfully called c functions from ada (the pragma import works fine),
but i'm having more difficulty the other way...
i'm trying to pass a string from c to ada:
extern void adaprint_s(char *str);
char str[81];
main(){
puts("enter a string:");
gets(str);
adaprint_s(str);
}
package adaprint is
type string_ptr is access string(1..81);
procedure adaprint_s(
str : IN string_ptr );
pragma export_procedure(internal=>adaprint_s,external=>adaprint_s,
parameter_types=>(string_ptr));
end;
with text_io;
use text_io;
package body adaprint is
procedure adaprint_s(
str : IN string_ptr )
is
begin
put("the string is:");
put_line(str.all);
end;
end;
now it looks like i'm passing the address of a string to ada, which is expect-
ing a string pointer, but somehow my adaprint.str is set to the first 4 char-
acters of the string, in reverse order! (i've inspected the values with debug).
if i pass the address of the string pointer ( adaprint_s(&str); ) everything
works fine, but i'm at a loss to understand this behavior...
if anyone out there can explain this to me, i'll sleep better tonight;-)
and can anyone tell me how to pass a simple integer? i'm having less luck with
that...
adTHANXvance,
the air drummer
next reply other threads:[~1988-10-16 0:23 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
1988-10-16 0:23 Maureen Cragg [this message]
1988-10-17 17:21 ` calling ada from c Maureen Cragg
-- strict thread matches above, loose matches on Subject: below --
1991-02-23 16:01 calling Ada from C David B Lightstone
1995-03-22 13:26 Calling " Roger L Costello
1995-03-22 13:58 ` David Paton
1995-03-23 17:22 ` Theodore Dennison
1995-03-24 17:14 ` Larry Kilgallen, LJK Software
1995-03-26 11:53 ` Robert Dewar
1995-03-27 14:47 ` Theodore Dennison
1995-03-28 0:00 ` Robert Dewar
1995-03-28 0:00 ` Cyrille Comar
1995-03-29 2:47 ` Larry Kilgallen, LJK Software
1995-03-29 0:00 ` Theodore Dennison
1995-04-04 0:00 ` Robert Dewar
1995-03-27 19:48 ` Robert I. Eachus
1995-03-29 0:00 ` Larry Kilgallen, LJK Software
1996-10-29 0:00 How is an ADA compiler done? Robert Dewar
1996-11-08 0:00 ` calling ADA from C EDSTAM Mikael
1996-11-14 0:00 ` Robert Dewar
2000-08-25 0:00 Calling Ada " Maxwelton
2007-02-22 15:46 hannibal.holm
2007-02-22 16:17 ` Ludovic Brenta
2007-02-22 17:28 ` Adam Beneschan
2007-02-22 20:40 ` Aurele
2007-02-23 13:53 ` Stephen Leake
2007-02-27 12:49 ` hannibal.holm
2007-02-27 18:03 ` Adam Beneschan
2007-02-28 2:54 ` Jeffrey R. Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox