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,55737cdd9f66c8ee X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-21 11:10:48 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!news.idc.ad.jp!newsfeed.mesh.ad.jp!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison Sender: usenet@www.newsranger.com References: <3AB8D3F9.FC6C6B9E@uundz.de> Subject: Re: Question: Exporting ADA functions to C Message-ID: Date: Wed, 21 Mar 2001 18:58:24 GMT NNTP-Posting-Host: 127.0.0.1 X-Complaints-To: abuse@newsranger.com X-Trace: www.newsranger.com 985201104 127.0.0.1 (Wed, 21 Mar 2001 13:58:24 EST) NNTP-Posting-Date: Wed, 21 Mar 2001 13:58:24 EST Organization: http://www.newsranger.com Xref: supernews.google.com comp.lang.ada:5975 Date: 2001-03-21T18:58:24+00:00 List-Id: In article <3AB8D3F9.FC6C6B9E@uundz.de>, Tilman Gloetzner says... >I am trying to hand over a c-struct to an ada record and vice versa. The .. >protable. Unfortunatelly, my test progam crashes with a core dump. Not .. > procedure Register_Record(C_Structure: in Rec_C); > procedure Get_Record(C_Structure: out Rec_C); > > pragma Export(C,Register_Record,"C_Register_Rec"); > pragma Export(C,Get_Record,"C_Get_Rec"); .. >extern void adainit (void); >extern void adafinal (void); >extern void C_Register_Rec(struct Ada_rec Structure); >extern void C_Get_Rec(struct Ada_rec Structure); Ada cannot deal with C "struct" parameters. Pointer to structs are ok, but not structs themselves. If I remember correctly, this is because C itself has no real standard (or no universally-followed standard) on how structs are passed, but that could be wrong. Anyway, the proper C prototypes for your exported Ada routines would be: extern void C_Register_Rec (struct Ada_rec * Structure); extern void C_Get_Reg (struct Ada_rec * Structure); --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html home email - mailto:dennison@telepath.com