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,74885c423a23a03e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!h54g2000cwb.googlegroups.com!not-for-mail From: rodkay@dodo.com.au Newsgroups: comp.lang.ada Subject: Re: C to Ada Date: 23 Nov 2006 18:28:46 -0800 Organization: http://groups.google.com Message-ID: <1164335326.802553.87760@h54g2000cwb.googlegroups.com> References: NNTP-Posting-Host: 58.163.88.116 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1164335332 27504 127.0.0.1 (24 Nov 2006 02:28:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 24 Nov 2006 02:28:52 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/48 (like Gecko) Safari/48,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: h54g2000cwb.googlegroups.com; posting-host=58.163.88.116; posting-account=566NuA0AAAD7iWzPbtXulrcGbAD2wGwm Xref: g2news2.google.com comp.lang.ada:7672 Date: 2006-11-23T18:28:46-08:00 List-Id: Brian May wrote: > Are there any up-to-date utilities for converting a C *.h file into a > Ada wrapper package? You might try the prototype SWIG 'ada' and 'gnat' modules. These attempt to generate Ada bindings to both C and C++ libraries. The 'ada' module is for any Ada compiler, and produces bindings based on a 'proxy' approach. The 'gnat' compiler targets the GNAT family of compilers, and produces Ada types and objects which are the binary equivalent of their corresponding C/C++ types. > I don't care if it requires cleaning up by hand afterwords. The generated bindings are pretty rough, and generally need to be 'pretty print' formatted, by gnatpp or another tool. There are also many style 'warts', which should eventually be cleared up. > > Or is it considered better to write the entire wrapper by hand? Bindings done by hand tend to be better than the auto-generated ones. SWIG produces very thin bindings. A decent compromise is to use SWIG to build a thin binding, and then write a thick binding by hand, on top of the thin. > > (considering a number of C libraries that I would like to be able to > access from Ada here but with no native Ada bindings yet). There is an example of a few SWIG 'gnat' bindings to the GNU Scientific Library (GSL) at svn co svn://58.163.88.116/anvil/gsl SWIG with the 'ada' & 'gnat' modules is available via svn co https://svn.sourceforge.net/svnroot/gnuada/trunk/projects/swig-1.3.29 The repository code is a little out of date, but recent changes should be committed within the next few days. regards.