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,64a6ad02ec510120 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-02 16:00:53 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!border1.nntp.aus1.giganews.com!nntp2.aus1.giganews.com!nntp.giganews.com!newsfeed1.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail From: "Eric G. Miller" Subject: Re: Interfacing to C library... User-Agent: Pan/0.13.0 (The whole remains beautiful (Debian GNU/Linux)) Message-ID: Newsgroups: comp.lang.ada References: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: Sat, 02 Nov 2002 23:59:59 GMT NNTP-Posting-Host: 216.119.6.14 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1036281599 216.119.6.14 (Sat, 02 Nov 2002 15:59:59 PST) NNTP-Posting-Date: Sat, 02 Nov 2002 15:59:59 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:30312 Date: 2002-11-02T23:59:59+00:00 List-Id: In , Robert A Duff wrote: > "Eric G. Miller" writes: > >> Missed that addition since I was looking at a copy of original RM... > > The version with all the Corrigendum AI's included is available on the > net somewhere. Maybe somebody can post the URL? adaic has the new one, adahome has the old one... >> Anyway, I don't think the C_Pass_By_Copy semantics quite work the way I >> want them too (or, it's "kludgy"). All the "Set" routines of this C >> library take C structs by copy while all the "Get" routines take pointers >> and all routines return (in the function sense) a long integer status >> code. > > Don't you mean the other way around? I mean if you're Set-ing a field, > you would need a pointer in C. You'd think! But it's Set-ing/Get-ing data managed by the library (in static C variables). >>... I've found if I use access types for the "Get" routines, then I >> have to worry about aliasing and need to use T'Unchecked_Access or I >> need to dynamically create the objects via "new". > > You can use access parameters instead of named access types, > and then you can say 'Access. Either way, you better make sure the C > code doesn't squirrel away a copy of the pointer. The library copies data back and forth. Presumably the "Set" routines don't take pointers so they can't modify the caller's input structures. The Get routines just copy data into supplied structs via the pointers. I'm not sure I understand your statement about using access parameters versus named access types (I'm still pretty green w.r.t. to Ada).... Aha! I missed that you couldn't mix "in/out" w/ "access" in a subprogram parameter list declaration/definition. Okay, definitely nicer than defining 40 access to record types...