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,610e53a911ec64b3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-03-24 07:32:08 PST Path: nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!xlink.net!howland.reston.ans.net!gatech!udel!news.mathworks.com!zombie.ncsc.mil!admii!cmcl2!thecourier.cims.nyu.edu!thecourier.cims.nyu.edu!nobody From: dewar@cs.nyu.edu (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: Importing C Structures Date: 24 Mar 1995 10:32:08 -0500 Organization: Courant Institute of Mathematical Sciences Message-ID: <3kuolo$c53@gnat.cs.nyu.edu> References: <3kr4q3$jd9@newsflash.concordia.ca> NNTP-Posting-Host: gnat.cs.nyu.edu Date: 1995-03-24T10:32:08-05:00 List-Id: First of all, the usual advice, if you have questions on GNAT, be SURE to copy them to gnat-report@cs.nyu.edu which is read by the key people on the GNAT development team, not all of whom read comp.lang.ada. There is a simple correspondence between data in Ada and data in C as follows: int -> integer short -> short_integer signed char -> short_short_integer long -> long integer char -> character any simple records map directly to the corresponding C record. In other words, pragma Convention C is the default for GNAT. This should be enough to get you started. For argument passing, see the RM, except there is ONE place we differ from the RM. We do NOT follow the implementation advice to pass IN parameters that are records by address, instead we pass them the same way that C would pass the record (which seems to us a better choice). This may be by address on some machines, but on some machines, depending on the size of the record, they are passed by value. It seems closer to the ABI to follow exactly the same scheme in Ada.