From: fjh@cs.mu.oz.au (Fergus Henderson)
Subject: Re: Compiling, binding, and linking an Ada prog. interfaced with C
Date: 1998/08/02
Date: 1998-08-02T00:00:00+00:00 [thread overview]
Message-ID: <6q26p7$3ad$1@mulga.cs.mu.OZ.AU> (raw)
In-Reply-To: EACHUS.98Jul30145039@spectre.mitre.org
eachus@spectre.mitre.org (Robert I. Eachus) writes:
>fjh@cs.mu.oz.au (Fergus Henderson) writes:
>
> > This is one respect in which Ada's otherwise excellent C interface
> > features are not quite as good as those of Mercury or ISE Eiffel,
> > which both allow you to import C macros without having to write a
> > separate C file containing glue code.
>
> Huh? The Ada way to imitate C in this area is to run the C
>preprocessor over your code and live with the result no matter how
>bizarre, just like it works in C.
I don't see how that technique could work as a method for interfacing
to existing C code, because typical C header files contain (in addition
to the macros that you want to interface with) lots of C declarations
which would not be valid Ada syntax.
Furthermore it would have the following problem that you mention yourself:
>Of course, if you have C macros
>that actually generate C source, then you can only use those inside
>units written in C.
Indeed. And so trying to use them in Ada source files would be at
best a violation of encapsulation, and more likely simply wouldn't work.
Even simple things like hexadecimal and octal constants would be
a problem.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.
next prev parent reply other threads:[~1998-08-02 0:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-07-27 0:00 Re:Compiling, binding, and linking an Ada prog. interfaced with C You4818
1998-07-28 0:00 ` Compiling, " Dr Richard A. O'Keefe
1998-07-29 0:00 ` Fergus Henderson
1998-07-30 0:00 ` Robert I. Eachus
1998-08-01 0:00 ` Robert Dewar
1998-08-02 0:00 ` Fergus Henderson
1998-08-04 0:00 ` Robert Dewar
1998-08-04 0:00 ` Fergus Henderson
1998-08-03 0:00 ` David Coote
1998-08-03 0:00 ` tedennison
1998-08-02 0:00 ` Fergus Henderson [this message]
[not found] ` <6pi57h$k1h$1@nnrp1.dejanews.com>
1998-07-28 0:00 ` Ronald Ali
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox