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-01 21:11:30 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed2.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 05:10:37 GMT NNTP-Posting-Host: 216.119.6.14 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1036213837 216.119.6.14 (Fri, 01 Nov 2002 21:10:37 PST) NNTP-Posting-Date: Fri, 01 Nov 2002 21:10:37 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:30305 Date: 2002-11-02T05:10:37+00:00 List-Id: In , tmora wrote: >> > I'm working on building an interface to a C library where most of the > The Windows bindings available at www.adapower.com do a lot of this. > >> Then write another package that is "thicker", and takes advantage >> of Ada features like exceptions. > For an example of a thick binding, may I modestly suggest you look > at the source code for Claw available at www.adapower.com > The TriAda paper available at > www.rrsoftware.com/html/prodinf/triadapaper/triada.html > has a discussion of some the decisions to be made for a thick, Ada-style, > binding. Also, IEEE Std 1003.5-1992, on the Ada binding to POSIX, > also discusses many of these issues. Okay, how to handle: /* C header */ struct foo { ... } long pass_by_value (struct foo); -- Ada Spec type foo is record ... end record; pragma Convention (C, foo); function Pass_By_Value (bar : foo) return Long_Integer; pragma Import (C, Pass_By_Value, "pass_by_value"); Seems Ada always passes records via C pointers. So, the above doesn't work. Surely, there's a way! Or do I need a C wrapper for my Ada wrapper ;-(