comp.lang.ada
 help / color / mirror / Atom feed
* How to manage a system call inside Ada ?
@ 2006-11-23 16:12 wlz
  2006-11-23 16:43 ` Georg Bauhaus
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: wlz @ 2006-11-23 16:12 UTC (permalink / raw)


Hi,
I want to call an editor inside Ada-Code. Is there a Ada function
like system(..) in C.
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 





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to manage a system call inside Ada ?
  2006-11-23 16:12 How to manage a system call inside Ada ? wlz
@ 2006-11-23 16:43 ` Georg Bauhaus
  2006-11-23 16:44 ` koburtch
  2006-11-24 17:35 ` wlz
  2 siblings, 0 replies; 4+ messages in thread
From: Georg Bauhaus @ 2006-11-23 16:43 UTC (permalink / raw)


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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to manage a system call inside Ada ?
  2006-11-23 16:12 How to manage a system call inside Ada ? wlz
  2006-11-23 16:43 ` Georg Bauhaus
@ 2006-11-23 16:44 ` koburtch
  2006-11-24 17:35 ` wlz
  2 siblings, 0 replies; 4+ messages in thread
From: koburtch @ 2006-11-23 16:44 UTC (permalink / raw)


What operating system are you using?

For linux, detailed instructions using system calls is available in my
online book at

   http://www.pegasoft.ca/resources/boblap/book.html

Ken B.

wlz wrote:
> Hi,
> I want to call an editor inside Ada-Code. Is there a Ada function
> like system(..) in C.
> 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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to manage a system call inside Ada ?
  2006-11-23 16:12 How to manage a system call inside Ada ? wlz
  2006-11-23 16:43 ` Georg Bauhaus
  2006-11-23 16:44 ` koburtch
@ 2006-11-24 17:35 ` wlz
  2 siblings, 0 replies; 4+ messages in thread
From: wlz @ 2006-11-24 17:35 UTC (permalink / raw)


Thanks to Georg and Ken.

Both suggestions works very well.

The Aonix IDE on the Windows machine needs a search path:
               SearchPath: f:\compiler\aonix\objectada\apilib

Rainer.

"wlz" <master@fgg-welzel.de> schrieb im Newsbeitrag 
news:ek4h7g$ph7$01$1@news.t-online.com...
> Hi,
> I want to call an editor inside Ada-Code. Is there a Ada function
> like system(..) in C.
> 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
> 





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-11-24 17:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-23 16:12 How to manage a system call inside Ada ? wlz
2006-11-23 16:43 ` Georg Bauhaus
2006-11-23 16:44 ` koburtch
2006-11-24 17:35 ` wlz

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