comp.lang.ada
 help / color / mirror / Atom feed
From: rodkay@dodo.com.au
Subject: Re: C to Ada
Date: 23 Nov 2006 18:28:46 -0800
Date: 2006-11-23T18:28:46-08:00	[thread overview]
Message-ID: <1164335326.802553.87760@h54g2000cwb.googlegroups.com> (raw)
In-Reply-To: <sa41wntstg9.fsf@margay.local>


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.




  reply	other threads:[~2006-11-24  2:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-23 22:12 C to Ada Brian May
2006-11-24  2:28 ` rodkay [this message]
2006-11-25 22:18   ` Brian May
2006-11-25 23:52     ` rodkay
2006-11-26 15:45       ` Robert A Duff
2006-11-26 18:12         ` Jeffrey Creem
2006-11-26 19:00         ` Martin Krischik
  -- strict thread matches above, loose matches on Subject: below --
2003-01-20 19:28 chris.danx
1997-02-23  0:00 Cliff Lim
1997-02-27  0:00 ` David Wheeler
1996-10-30  0:00 Eiffel and Java + Ada dispatching Jon S Anthony
1996-11-04  0:00 ` Don Harrison
1996-11-04  0:00   ` C to Ada Ali Mirhosseini
1996-11-04  0:00     ` Robert Dewar
1996-11-04  0:00     ` Matthew Daniel
1995-04-07  0:00 c to ada JH Lee
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox