From: "C.G. Williams" <cgw1@le.ac.uk>
Subject: Calling C function with structure parameter from ADA
Date: Tue, 28 Mar 1995 18:22:32 +0100
Date: 1995-03-28T18:22:32+01:00 [thread overview]
Message-ID: <Pine.SGI.3.91.950328180834.25150D-100000@hawk> (raw)
A friend from China (Dr Kougen Zheng) asked me to post this request...
Help Please!!!
Q: How can an ADA program call a C function with a structure as a parameter?
Any help will be greatly appreciated
Please respond to: cgw1@le.ac.uk
(I will post a summary of any replies in a few days)
Details...
The interpreter used is Adaed-1.11.0a
What I did was...
$ cc -c sub.c
$ adacomp -nl runlib -i sub.o -a -b struct.ada
$ adaexec runlib
Error: core dumped!!!
****************** struct.ada *************************************
procedure first is
type Point is record
x : INTEGER;
y : INTEGER;
end record;
a : Point;
procedure PRINTA ( pp : in Point);
pragma INTERFACE ( C, PRINTA);
begin
PRINTA(a);
end;
************** sub.c *************************************
#include <stdio.h>
typedef struct {
int x;
int y;
} Point;
printa(pp)
Point pp;
{
printf("\n coordinate = ( %d , %d )", pp.x, pp.y);
}
***********************************************************************
Ceri Williams cgw1@le.ac.uk
PhD Research student
Geology Dept
Leicester University
Leicester
U.K.
next reply other threads:[~1995-03-28 17:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-03-28 17:22 C.G. Williams [this message]
1995-03-29 0:00 ` Calling C function with structure parameter from ADA Theodore Dennison
1995-04-06 0:00 ` Robert Dewar
1995-04-07 0:00 ` Chris Warack <sys mgr>
1995-04-07 0:00 ` Robert Dewar
[not found] ` <D6pwGs.8wE@thomsoft.com>
1995-04-19 0:00 ` Fergus Henderson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox