comp.lang.ada
 help / color / mirror / Atom feed
From: mgk25@cl.cam.ac.uk (Markus Kuhn)
Subject: Re: Accessing C macro constants from Ada95
Date: 1999/04/11
Date: 1999-04-11T00:00:00+00:00	[thread overview]
Message-ID: <7eqoj2$r27$1@pegasus.csx.cam.ac.uk> (raw)
In-Reply-To: 7ep6uj$o97$1@nnrp1.dejanews.com

Robert Dewar <robert_dewar@my-dejanews.com> writes:
|> First, of course there is documentation on how to use
|> the Posix interface, this is an IEEE standard, just as
|> for Ada you go to the RM, you go to the Posix standard
|> for details on the Ada binding to Posix.

Well, for those poor students who can't afford to buy the final
expensive document, there are even various inofficial drafts
floating arround. One was recently seen for instance briefly on
<http://www.cl.cam.ac.uk/~mgk25/volatile/> ...

|> Second, I see no particular reason to use these bindings.

|> As for it being "kind'a hard to write .. Unix stuff [in
|> Ada]" that makes no sense, it is quite straightforward
|> in Ada to call any system services or other functions
|> that you need.

Calling C library function from Ada95 sucks in one very
significant way: The authors of the C Interface annex of the
Ada95 standard have completely forgotten to generate a facility
for accessing C macro constants. What would be necessary is that every
Ada95 compiler that implements a C interface contains a complete
ISO C macro preprocessor. An import pragma would then allow to extract
an arbitrary numeric constant from any specifyable *.h file and
could then be used as an Ada constant.

Ada does indeed have nice facilities to access functions and variables
in C object files, but what has been completely forgotten is that
under C, traditionally a very significant part of the API comes
in the form of numeric macro constants defined in *.h files. And
Ada95 does not provide a portable way to get at these. Ada
programmers should not have to write buggy and dangerous Perl
hacks again and again to get access to the constants in C header
files. That I think is the main reason why people are interested
in POSIX.5, which provides all the necessary constants at least
for this important API.

Markus

-- 
Markus G. Kuhn, Computer Laboratory, University of Cambridge, UK
Email: mkuhn at acm.org,  WWW: <http://www.cl.cam.ac.uk/~mgk25/>




  parent reply	other threads:[~1999-04-11  0:00 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-07  0:00 Linux Kernel in Ada. Repost Bruce MacDonald
1999-04-07  0:00 ` Matthew Heaney
1999-04-08  0:00 ` Jeffrey D. Cherry
1999-04-09  0:00   ` Corey Ashford
1999-04-09  0:00     ` me
1999-04-09  0:00       ` Tarjei Tj�stheim Jensen
1999-04-09  0:00         ` bill_
1999-04-10  0:00           ` Tarjei Tj�stheim Jensen
1999-04-10  0:00             ` Mich
1999-04-10  0:00               ` Tarjei Tj�stheim Jensen
1999-04-11  0:00                 ` Robert Dewar
1999-04-12  0:00                 ` OpenToken project announcement dennison
1999-04-11  0:00               ` Linux Kernel in Ada. Repost Robert Dewar
1999-04-10  0:00                 ` Kevin
1999-04-13  0:00                 ` Harry Tanovich
1999-04-13  0:00                   ` Robert Dewar
1999-04-11  0:00             ` Jerry van Dijk
1999-04-11  0:00           ` Jerry van Dijk
1999-04-11  0:00             ` Robert Dewar
1999-04-14  0:00               ` Aidan Skinner
1999-04-11  0:00           ` Robert Dewar
1999-04-10  0:00             ` mike
1999-04-11  0:00               ` Robert Dewar
1999-04-12  0:00                 ` Samuel Mize
1999-04-13  0:00                   ` Robert Dewar
1999-04-16  0:00                     ` Samuel Mize
1999-04-11  0:00             ` Markus Kuhn [this message]
1999-04-11  0:00               ` Accessing C macro constants from Ada95 Jerry van Dijk
1999-04-12  0:00               ` Robert Dewar
1999-04-13  0:00                 ` Markus Kuhn
1999-04-13  0:00                   ` Robert Dewar
1999-04-13  0:00                     ` dennison
1999-04-12  0:00               ` Aidan Skinner
1999-04-13  0:00                 ` Robert Dewar
1999-04-12  0:00               ` Robert Dewar
1999-04-12  0:00               ` Tarjei Tj�stheim Jensen
1999-04-12  0:00               ` Robert Dewar
1999-04-09  0:00       ` Linux Kernel in Ada. Repost Larry Kilgallen
1999-04-09  0:00         ` David Starner
1999-04-09  0:00           ` Brian Rogoff
1999-04-11  0:00           ` Robert Dewar
1999-04-12  0:00         ` Hans N. Beck
1999-04-09  0:00     ` Jeffrey D. Cherry
1999-04-11  0:00   ` Robert Dewar
1999-04-12  0:00     ` Bruce MacDonald
1999-05-03  0:00 ` Buz Cory
1999-05-03  0:00   ` Hans N. Beck
replies disabled

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