Re: C to Ada
- From: rodkay@xxxxxxxxxxx
- Date: 23 Nov 2006 18:28:46 -0800
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.
.
- Follow-Ups:
- Re: C to Ada
- From: Brian May
- Re: C to Ada
- References:
- C to Ada
- From: Brian May
- C to Ada
- Prev by Date: Re: How to use associative arrays in Ada 2005?
- Next by Date: Re: a question on basic types of interfaces.C
- Previous by thread: C to Ada
- Next by thread: Re: C to Ada
- Index(es):
Relevant Pages
|