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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6413b417b806eb28 X-Google-Attributes: gid103376,public From: mgk25@cl.cam.ac.uk (Markus Kuhn) Subject: Re: Accessing C macro constants from Ada95 Date: 1999/04/11 Message-ID: <7eqoj2$r27$1@pegasus.csx.cam.ac.uk>#1/1 X-Deja-AN: 465172089 References: <7eg43i$d3b$1@nnrp1.dejanews.com> <370CC730.4C6112DB@utech.net> <370D7007.2D3AD58B@rocketmail.com> <7el9so$geb@drn.newsguy.com> <7elrg5$egk2@ftp.kvaerner.com> <7emjk8$rp3@drn.newsguy.com> <7ep6uj$o97$1@nnrp1.dejanews.com> Organization: U of Cambridge Computer Lab, UK Newsgroups: comp.lang.ada Date: 1999-04-11T00:00:00+00:00 List-Id: Robert Dewar 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 ... |> 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: