comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Ada  "library only" compiler ?
Date: Sat, 21 Jul 2012 14:05:26 +0300
Date: 2012-07-21T14:05:26+03:00	[thread overview]
Message-ID: <a6vgnnFrntU1@mid.individual.net> (raw)
In-Reply-To: <xO-dndcH8ZJTR5TNRVn_vwA@giganews.com>

On 12-07-21 01:25 , Peter C. Chapin wrote:
> 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.

You are right, in principle, and I was simplifiying. With "low-level 
Ada" I meant accessing machine-level stuff like I/O ports.

> For some systems "doing what must be done" involves executing exotic
> instructions that (standard) C compilers can't generate.

I would guess that they mostly use assembly-code insertions in C source.

> 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.

True, and Randy Brukardt says in a later post they did it in that way 
for the Janus/Ada compiler on SCO Unix.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .





  parent reply	other threads:[~2012-07-26 14:50 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
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 [this message]
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