comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter C. Chapin" <PChapin@vtc.vsc.edu>
Subject: Re: Ada  "library only" compiler ?
Date: Fri, 20 Jul 2012 18:25:17 -0400
Date: 2012-07-20T18:25:17-04:00	[thread overview]
Message-ID: <xO-dndcH8ZJTR5TNRVn_vwA@giganews.com> (raw)
In-Reply-To: <a6tvrmFdinU1@mid.individual.net>

On 2012-07-20 17:11, Niklas Holsti wrote:

> GNAT runs on operating systems (Windows, Linux, etc.) in which the
> Application Programming Interface is defined in C. In order to open a
> file under Linux, the application (here GNAT) *must* use the open() or
> fopen() functions, which are defined in the API as C functions. Trying
> to open a file using "low-level Ada" would be breaking the OS interface
> which is obviously a bad idea (and probably impossible because an
> application does not have the necessary low-level access rights for that).

I don't think this is quite right. Entrance into the operating system is 
ultimately done in machine language. The C API functions you're talking 
about are thin wrappers that present a C callable interface and then do 
what must be done to actually invoke the system. For some systems "doing 
what must be done" involves executing exotic instructions that 
(standard) C compilers can't generate. Thus one supposes that functions 
like open(), etc, are written in assembly language or its moral equivalent.

This could be done for Ada. An Ada procedure could be written that wraps 
the same assembly language magic but that provides an Ada interface to 
the system... no need to use clib in that case.

Of course the system interface isn't standardized whereas the C 
interface is (POSIX). If the raw interface to the underlying system 
changed the Ada interfacing code would have to change. Of course the 
same could be said for clib (the clients of clib wouldn't have to change 
but clib itself would).

I believe there is, in fact, an Ada standard interface to POSIX-like 
systems. My understanding is that there is no requirement that says the 
implementation of that interface must be done on top of C.

Peter




  parent reply	other threads:[~2012-07-26 14:37 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20 20:05 Ada "library only" compiler ? Patrick
2012-07-20 21:11 ` Niklas Holsti
2012-07-20 21:47   ` Ludovic Brenta
2012-07-20 22:25   ` Peter C. Chapin [this message]
2012-07-20 22:51     ` Ludovic Brenta
2012-07-21  0:32       ` Randy Brukardt
2012-07-21 12:39         ` Pascal Obry
2012-07-22  4:59           ` Shark8
2012-07-22  7:04             ` Pascal Obry
2012-07-22 10:17           ` Florian Weimer
2012-07-24  1:54           ` Randy Brukardt
2012-07-24 16:50             ` Pascal Obry
2012-07-24 18:01               ` Vasiliy Molostov
2012-07-24 21:30                 ` Pascal Obry
2012-07-25  6:33                   ` Vasiliy Molostov
2012-07-25 23:44                   ` sbelmont700
2012-07-25 23:34               ` Randy Brukardt
2012-07-21 11:05     ` Niklas Holsti
2012-07-20 23:30   ` Patrick
2012-07-21 16:47     ` Niklas Holsti
2012-07-21 17:47       ` Patrick
2012-07-21 19:22         ` Simon Wright
2012-07-21 19:38           ` Patrick
2012-07-21 22:53         ` Brian Drummond
2012-07-22  3:25           ` Patrick
2012-07-22 17:54             ` Brian Drummond
2012-07-22 17:59               ` Brian Drummond
2012-07-22 18:44                 ` Patrick
2012-07-22 21:03                   ` Brian Drummond
2012-07-25 19:10                   ` J-P. Rosen
     [not found]               ` <m2a9yrsbf5.fsf@nidhoggr.home>
     [not found]                 ` <jui36a$hs0$1@dont-email.me>
2012-07-23 10:10                   ` Simon Wright
2012-07-24 10:55                     ` Brian Drummond
2012-07-22 21:25             ` Niklas Holsti
2012-07-22 22:00               ` Patrick
2012-07-22 21:18         ` Niklas Holsti
2012-07-21  0:27   ` Randy Brukardt
2012-07-21  7:36     ` Dmitry A. Kazakov
2012-07-21 13:31     ` Niklas Holsti
     [not found]   ` <olpj085ii9fpifpligh6jerghoaieiim1d@invalid.netcom.com>
2012-07-20 23:38     ` Patrick
2012-07-21 13:12     ` Niklas Holsti
2012-07-23  5:02 ` Miles Bader
replies disabled

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