comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus@futureapps.de>
Subject: Re: How to manage a system call inside Ada ?
Date: Thu, 23 Nov 2006 17:43:49 +0100
Date: 2006-11-23T17:43:51+01:00	[thread overview]
Message-ID: <1164300228.5369.27.camel@localhost.localdomain> (raw)
In-Reply-To: <ek4h7g$ph7$01$1@news.t-online.com>

On Thu, 2006-11-23 at 17:12 +0100, wlz wrote:
> Hi,
> I want to call an editor inside Ada-Code. Is there a Ada function
> like system(..) in C.

This may depend on compiler and system.

with Interfaces.C;
with Ada.Text_IO; use Ada;

procedure edit is

   package C renames Interfaces.C;

   function system(command: C.char_array) return C.int;
   pragma import(C, system);  -- have the compiler choose the linke name
   --pragma import(C, system, "system");

   rc: C.int;
begin
   rc := system(C.To_C("editor"));

   Text_IO.put_line(Text_IO.current_error,
      "system returns" & C.int'image(rc));
end edit;


> I tried to import a C function with this system call. But this failed, the
> Ada Linker is missing the label _system.
> 
> I hope somebody can help.
> 
> thx  - rainer 
> 
> 




  reply	other threads:[~2006-11-23 16:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-23 16:12 How to manage a system call inside Ada ? wlz
2006-11-23 16:43 ` Georg Bauhaus [this message]
2006-11-23 16:44 ` koburtch
2006-11-24 17:35 ` wlz
replies disabled

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