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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,91cedaee59262cd8,start X-Google-Attributes: gid103376,public From: Simon Wright Subject: Re: Interfacing with C Date: 1999/12/30 Message-ID: #1/1 X-Deja-AN: 566576983 X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 References: X-Trace: news.demon.co.uk 946577656 nnrp-01:6609 NO-IDENT pogner.demon.co.uk:158.152.70.98 Organization: At Home Newsgroups: comp.lang.ada X-Complaints-To: abuse@demon.net Date: 1999-12-30T00:00:00+00:00 List-Id: Jan Kroken writes: > void y (datum d) > { > printf("d.size=%d\n",d.dsize); > } > procedure y (d: datum); > pragma Import(C,y,"y"); > What I don't understand here is that x works perfectly, while > the datum in y gets fucket up. Why? Normally when passing a struct in C you would pass a pointer to it: void y (datum *d) I don't know what the standard says about passing structs, but it's quite likely your Ada and C compilers are disagreeing. See LRM B.3(69): An Ada parameter of a record type T, of any mode, is passed as a t* argument to a C function, where t is the C struct corresponding to the Ada type T.