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-7-bit X-Google-Thread: 103376,747be3e35071507b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-03-29 09:19:57 PST Path: nntp.gmd.de!Germany.EU.net!howland.reston.ans.net!pipex!warwick!leicester!hawk!cgw1 From: "C.G. Williams" Newsgroups: comp.lang.ada Subject: Calling C function with structure parameter from ADA Date: Tue, 28 Mar 1995 18:22:32 +0100 Organization: University of Leicester, UK Message-ID: NNTP-Posting-Host: irix.le.ac.uk Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Sender: cgw1@hawk Date: 1995-03-28T18:22:32+01:00 List-Id: 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 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.