Re: How to manage a system call inside Ada ?



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



.



Relevant Pages

  • Re: Current status of Ada?
    ... learning and using this great language. ... The reason why compilers maker can't make their compiler totally free ... I agree with you that most of the links you can find on Ada websites ... AdaCore has contributed a free gnat compiler to ...
    (comp.lang.ada)
  • Re: Ravenscar-compliant bounded buffer
    ... the mid 1980's most compiler are FRONT_END compilers aka ... any system build around GNAT will contain the C code that GNAT ... The XGC Ada which is based on GNAT and uses C for its Real Time ... with VAXes for data processing applications. ...
    (comp.lang.ada)
  • Re: 7E7 Flight Controls Electronics
    ... Given that people had choices and Ada ... the 800 or so programming languages in use by the DoD, ... DoD1 was expected to provide a 'language of last resort', ... need modifications to a compiler to support particular requirements, ...
    (comp.lang.ada)
  • Re: Distributed Computing in Ada
    ... no shared memory. ... Ada tasks /can/ share memory, ... The problem is that the compiler can't know which variables are shared. ... The unit of distribution ...
    (comp.lang.ada)
  • Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... Though I haven't done so recently, back when I used Ada, nowhere close ... This can be ameliorated in a case like GNAT, where the Ada compiler ... _every_ programming language places severe limits on expressiveness; ... Ada's exception handling is also primitive at best (exceptionally so, ...
    (comp.lang.cpp)