comp.lang.ada
 help / color / mirror / Atom feed
* "system" Call in GNAT?
@ 1999-04-05  0:00 M. Smith
  1999-04-05  0:00 ` Jerry van Dijk
  1999-04-07  0:00 ` Robert Dewar
  0 siblings, 2 replies; 3+ messages in thread
From: M. Smith @ 1999-04-05  0:00 UTC (permalink / raw)
  To: Roga Danar

Hi All,

    I was looking for a call in GNAT that would make invoke a command to the OS
for me and  I found the function "system" and "execl".

    Unfortunatly, I have not been able to link these either of these calls with
my test driver.

    Am I missing something here?  I have been only working for a short time with
GNAT.

    My code and the error message follow.

-- *****************************************************************

My code is =>

with Win32;
with Win32.WinNT;
with Win32.crt.Process;

with Win32.Shellapi;
with Interfaces.C;
with Interfaces.C.Strings;

with Ada.Text_Io;

procedure Test_Command is

   use Ada;

   package C renames Interfaces.C;
   package C_Str renames C.Strings;

   Command_Str : C_Str.chars_ptr := C_Str.New_String("DIR T* ");
   Arg      : String := "/w";

   type int_ptr is access C.Int;

   args : int_ptr := new C.Int'(1);
   ppt_char : Win32.Shellapi.PPTCHAR := new Win32.PCHAR'(new C.CHAR'(c.nul));

   status : C.Int := 0;

begin

   ppt_char := Win32.Shellapi.CommandLineToArgvW (
               Win32.To_PSTR (Command_Str),
               args);
   text_io.put (C.To_Ada (ppt_char.all.all));

  text_io.put_line (C_Str.Value (Command_Str));

--  status := Win32.crt.Process.system (p1 => Win32.To_PCSTR (Command_Str));
  status := Win32.crt.Process.execl (cmdname => Win32.To_PCSTR (Command_Str));

end Test_Command;

--*******************************************************

The Error message is =>


gnatbind -aO./
-aOC:\usr\lib\gcc-lib\i586-pc-mingw32\2.7.2\adainclude;C:\My_Work;C:\My_Work\Win32Ada\src;C:\My_Work\Jeff\Communication;C:\My_Work\Jeff\Database;C:\My_Work\Jeff\Communication;C:\My_Work\Jeff\Database;C:\My_Work\Jeff\Executive;C:\My_Work\Jeff\Misc;C:\My_Work\database\odbc;C:\My_Work\database\sql;C:\USR\lib\gcc-lib\i586-pc-mingw32\2.7.2\adalib
-I- -x Test_Command.ali
gnatlink -mwindows -lodbc32 Test_Command.ali
./stdarg-inst.o(.text+0xb9):stdarg-inst.ad: undefined reference to `to_long'
./stdarg-inst.o(.text+0x69b):stdarg-inst.ad: undefined reference to `to_long'
./stdarg-inst.o(.text+0xf67):stdarg-inst.ad: undefined reference to `to_long'
./stdarg-inst.o(.text+0x1829):stdarg-inst.ad: undefined reference to `to_double'

./stdarg-inst.o(.text+0x1b15):stdarg-inst.ad: undefined reference to `to_double'

./win32-crt-process.o(.text+0x4dd):win32-crt-process.adb: undefined reference to
`do_varargs'
./win32-crt-process.o(.text+0x718):win32-crt-process.adb: undefined reference to
`do_varargs'
./win32-crt-process.o(.text+0x911):win32-crt-process.adb: undefined reference to
`do_varargs'
./win32-crt-process.o(.text+0xb4c):win32-crt-process.adb: undefined reference to
`do_varargs'
./win32-crt-process.o(.text+0xd66):win32-crt-process.adb: undefined reference to
`do_varargs'
./win32-crt-process.o(.text+0xfc1):win32-crt-process.adb: more undefined
references to `do_varargs' follow
gnatmake: *** link failed.
Process completed with exit code 2






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

end of thread, other threads:[~1999-04-07  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-05  0:00 "system" Call in GNAT? M. Smith
1999-04-05  0:00 ` Jerry van Dijk
1999-04-07  0:00 ` Robert Dewar

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