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,d71460587da14d5b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-31 13:33:39 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!freenix!enst.fr!beeblebrox!nobody From: Samuel Tardieu Newsgroups: comp.lang.ada Subject: Re: Importing C structs? Date: Thu, 31 Jul 2003 22:17:59 +0200 Organization: Avian Carrier & Friends Message-ID: <87wudy4fig.fsf@inf.enst.fr> References: NNTP-Posting-Host: willow.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: avanie.enst.fr 1059683529 59622 137.194.161.3 (31 Jul 2003 20:32:09 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Thu, 31 Jul 2003 20:32:09 +0000 (UTC) User-Agent: Gnus/5.090007 (Oort Gnus v0.07) XEmacs/21.5 (cauliflower, i386--freebsd) Cancel-Lock: sha1:6Uf8v1qsdv4gIFj/Ec9I9e4CWaI= X-Leafnode-NNTP-Posting-Host: 127.0.0.1 Xref: archiver1.google.com comp.lang.ada:41104 Date: 2003-07-31T22:17:59+02:00 List-Id: >>>>> "Simon" == Simon Wright writes: Simon> I'm pretty sure GNAT will do the Right Thing here (ie pass the Simon> address of the record parameter). I suppose there might be Simon> problems with very small arrays on architectures where these Simon> are passed in registers? but since the Ada and C compilers have Simon> the same backend you are quite likely to be lucky. pragma Simon> Convention (C, ) means "do what the C compiler expects", after Simon> all. Not exactly, but quite. The RM suggests that any record be passed by reference, while on most platforms small records (not greater than a word) are expected on the stack or in a register. GNAT follows the RM suggestion but allows you to override this choice by applying pragma Pass_By_Copy (GNAT specific) to your record type. Sam -- Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/sam