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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,92640d662fc31a03 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-05-04 05:12:54 PST Path: newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!howland.erols.net!netnews.com!xfer02.netnews.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3AF28F9A.6DC3BD90@earthlink.net> From: "Marc A. Criley" Organization: Quadrus Corporation X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: howto make system calls (newbie question) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 04 May 2001 12:12:55 GMT NNTP-Posting-Host: 63.178.180.104 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 988978375 63.178.180.104 (Fri, 04 May 2001 05:12:55 PDT) NNTP-Posting-Date: Fri, 04 May 2001 05:12:55 PDT X-Received-Date: Fri, 04 May 2001 05:11:21 PDT (newsmaster1.prod.itd.earthlink.net) Xref: newsfeed.google.com comp.lang.ada:7146 Date: 2001-05-04T12:12:55+00:00 List-Id: Lars Lundgren wrote: > > On Fri, 4 May 2001, L.H.Jeong wrote: > > > > > procedure Command is > > > > function C_System(value : String) return integer; > > pragma Import( > > C, C_System, "system"); > > > > result : integer; > > begin > > result := C_System("pwd "); > > result := C_System(value => "acdsee D:\work\pictures\BP47.jpg "); > > end Command; > > > > > > > > Thank you very much! > > That does do the trick for me. > > However i'm rather surprised to see you suggest that I escape ada and > import C-functions. Is it really the case that such a (from my > perspective) basic function can not be done solely in Ada - despite its > extensive libraries? "system" is neither part of C, nor part of Ada, it is an OS function that uses a C-style calling syntax. There's a widespread belief that OS functions, string handling functions, and so on, are all part of C, which makes C so much more powerful than languages like Ada. In reality, all those functions are provided in libraries for which C bindings have merely been provided by the vendor. The libraries themselves can be written in any programming language, it is simply that a C-style calling syntax must be provided. I've worked on a shared library, completely written in Ada, that is invoked by C and Ada applications. Even the Ada applications have to use "pragma Import(C, ...)" to gain access to its functions. (And of course the library specifies pragma Export for the visible entities.) Marc A. Criley Senior Staff Engineer Quadrus Corporation www.quadruscorp.com