comp.lang.ada
 help / color / mirror / Atom feed
* Calling C function with structure parameter from ADA
@ 1995-03-28 17:22 C.G. Williams
  1995-03-29  0:00 ` Theodore Dennison
  0 siblings, 1 reply; 6+ messages in thread
From: C.G. Williams @ 1995-03-28 17:22 UTC (permalink / 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.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1995-04-19  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-03-28 17:22 Calling C function with structure parameter from ADA C.G. Williams
1995-03-29  0:00 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox