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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8bfa37a97c46a2a5 X-Google-Attributes: gid103376,public From: kilgallen@eisner.decus.org (Larry Kilgallen) Subject: Re: Keeping Ada and C data structures in sync Date: 1999/05/21 Message-ID: <1999May21.152059.1@eisner>#1/1 X-Deja-AN: 480638651 X-Nntp-Posting-Host: eisner.decus.org References: <37459F82.BB2DB17@bbn.com> X-Trace: news.decus.org 927314463 14631 KILGALLEN [216.44.122.34] Organization: LJK Software Reply-To: Kilgallen@eisner.decus.org.nospam Newsgroups: comp.lang.ada Date: 1999-05-21T00:00:00+00:00 List-Id: In article <37459F82.BB2DB17@bbn.com>, Fred Roeber 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