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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,d8e3cd3d8dbaa4fb X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.216.84.129 with SMTP id s1mr632837wee.2.1343314220767; Thu, 26 Jul 2012 07:50:20 -0700 (PDT) Path: q11ni75791932wiw.1!nntp.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!border1.nntp.ams2.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!nntp.giganews.com!ramfeed-1.ams.xsnews.nl!feed.xsnews.nl!border-1.ams.xsnews.nl!newsfeed.straub-nv.de!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Ada "library only" compiler ? Date: Sat, 21 Jul 2012 14:05:26 +0300 Organization: Tidorum Ltd Message-ID: References: <2879c45e-f8e0-4434-9f82-968c585a4539@googlegroups.com> Mime-Version: 1.0 X-Trace: individual.net OFch5rNrMBajiDrAfQ0CigjKO21SjCvWVbHIpJlkgTSBoTAqYhBSyfAJTVzlf9th2r Cancel-Lock: sha1:5R/DHe3aqV2ZpUEHxCY1SqZ/RII= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-07-21T14:05:26+03:00 List-Id: 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 . @ .