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-Thread: 103376,d31a17870ca7e7e8 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 12 Jun 2007 19:18:54 -0500 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Interfacing to C: API with macros References: <1181679449.352274.217590@g37g2000prf.googlegroups.com> X-Newsreader: Tom's custom newsreader Message-ID: Date: Tue, 12 Jun 2007 19:18:55 -0500 NNTP-Posting-Host: 24.6.140.189 X-Trace: sv3-yiMZx9akjWWrgBowtcIqTPnGIiTNmXXg0C5dsbK7UQpUdnZU9fHGyzwrPbXV/B2LImU7bW4gSgi2sba!G2HERzsD4whvCIfvVrIxryDmyQeLhvI7+gk5KT1xeCb2wVEayyGRl1RCys11eYQc2l1Qz0CjuKkM!yueLhGJ3i1uaSCiC/Y3GmIPOtyPH X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.34 Xref: g2news1.google.com comp.lang.ada:16176 Date: 2007-06-12T19:18:55-05:00 List-Id: > Again, the straightforward solution: thin wrapper in C, that itself is > simple enough to be easily imported by Ada code. > > Again: is this THE solution? > > Looks like in order to write any nontrivial system software the poor > Ada programmer has to start with an awful lots of wrappers - where is > maintainability and productivity when you need them? ;-) If you are interfacing to something that isn't documented, then you will indeed have to experimentally determine the interface, or make a wrapper from unknown to known interface spec. Usually the interface is documented (though too often erroneously), though you may have to look carefully to see, for instance, what some bit-field packing macro is doing. Once you know, you can write a direct Ada interface. Claw, for instance, uses a great number of Windows API calls, and it uses no wrappers in C (though the whole point of Claw is to give an Ada-flavor wrapper to the Windows API). Many APIs in the Windows world also have typelib descriptions that can be used to automatically generate an Ada wrapper.