comp.lang.ada
 help / color / mirror / Atom feed
From: kilgallen@eisner.decus.org (Larry Kilgallen)
Subject: Re: Keeping Ada and C data structures in sync
Date: 1999/05/21
Date: 1999-05-21T00:00:00+00:00	[thread overview]
Message-ID: <1999May21.152059.1@eisner> (raw)
In-Reply-To: 37459F82.BB2DB17@bbn.com

In article <37459F82.BB2DB17@bbn.com>, Fred Roeber <froeber@bbn.com> writes:
> I have a question that has probably been asked before (even though I
> haven't been able to find any references to). The project I am on has
> some code written in C and some in Ada. The two parts of the program
> have to communicate by passing data structures. Does anyone know of a
> good way to keep data structure declarations consistent between C and
> Ada?
> 
> We have wondered about several solutions:
> - using a translator to derive C include files from Ada

Ada advocates have produced tools to do the reverse, primarily addressed
at producing Ada bindings to code from Ada-hostile vendors.  The direction
you want may also be available.

> - using some sort of IDL with the appropriate compilers to derive
>   C and Ada versions of the structure definitions from the common
>   input language

David Botton has recently published something that takes this approach
with Ada from a Microsoft input file.  Check Deja.com for posts from
this group within the past two months.

MacOS and VMS quite separately and some time ago selected the second
approach for supporting disparate languages, at least for OS entrypoints.
I know the VMS mechanism has data structure support as an equal goal --
the MacOS tool is less familiar to me.

The VMS tool was developed before Ada, and as a result Ada support
had to be retrofitted, and there was not always a one-to-one mapping
between capabilities of the input language and capabilities of Ada.
While that would not be a problem for your stated goal of supporting
just two languages, I am sure you have considered the problem of what
to do if (for instance by customer edict) you are required in the
future to add another language (let us say LISP, just to make it
non-obvious).

The VMS tool is now on the VMS Freeware disc, and should be portable
(with a little effort) to any operating system with a PL/I compiler.

> Has anybody had experience/success with either of these approaches. Does
> anyone know of some other better method? Thanks for any advice.

I think there is no ideal solution, as computer languages evolve and
add concepts that are unknown in other computer languages.  Whatever
approach you take, make sure you get management buy-in to ensure you
have ongoing maintenance of the tool.  With the second approach this
has been a problem for both Apple and DEC, each of which had programming
staffs probably larger than yours.

Larry Kilgallen




  parent reply	other threads:[~1999-05-21  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-21  0:00 Keeping Ada and C data structures in sync Fred Roeber
1999-05-21  0:00 ` dennison
1999-05-21  0:00 ` Larry Kilgallen [this message]
1999-05-22  0:00 ` Robert Dewar
1999-05-24  0:00   ` Samuel Mize
1999-05-23  0:00 ` Aidan Skinner
1999-05-23  0:00   ` David Botton
1999-05-23  0:00     ` Bob
1999-05-24  0:00       ` Chris
1999-05-24  0:00         ` David Botton
replies disabled

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