comp.lang.ada
 help / color / mirror / Atom feed
* Re: running an exe from gnat
  1997-03-17  0:00 running an exe from gnat Mindy Matusewicz
@ 1997-03-17  0:00 ` Robert Dewar
  1997-03-17  0:00 ` Samuel Tardieu
  1997-03-18  0:00 ` Gautier
  2 siblings, 0 replies; 4+ messages in thread
From: Robert Dewar @ 1997-03-17  0:00 UTC (permalink / raw)



<<I am running gnat for windows nt on my pentium and I need to call an exe
program.  How do you do that in Ada?

Mindy Matusewicz>>

There is no standard way of doing this that is portable (indeed even the
notion of an exe file is obviously system dependent).

However, look in GNAT.OS_Lib (in file g-os_lib.ads.

You will find some useful functions there (such as Spawn,
Non_Blocking_Spawn, and Wait_Process) that will allow you to
do this in a manner that is at least portable across GNAT
compilers.

In general there is quite a bit of useful stuff in the GNAt hierarchy,
and we add to it all the time, so be sure to check it out!





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

* running an exe from gnat
@ 1997-03-17  0:00 Mindy Matusewicz
  1997-03-17  0:00 ` Robert Dewar
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mindy Matusewicz @ 1997-03-17  0:00 UTC (permalink / raw)



I am running gnat for windows nt on my pentium and I need to call an exe
program.  How do you do that in Ada?

Mindy Matusewicz




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

* Re: running an exe from gnat
  1997-03-17  0:00 running an exe from gnat Mindy Matusewicz
  1997-03-17  0:00 ` Robert Dewar
@ 1997-03-17  0:00 ` Samuel Tardieu
  1997-03-18  0:00 ` Gautier
  2 siblings, 0 replies; 4+ messages in thread
From: Samuel Tardieu @ 1997-03-17  0:00 UTC (permalink / raw)
  To: Mindy_matusewicz


>>>>> "Mindy" == Mindy Matusewicz
>>>>> <Mindy_matusewicz@ny.essd.northgrum.com> writes:

Mindy> I am running gnat for windows nt on my pentium and I need to
Mindy> call an exe program.  How do you do that in Ada?

Just as you does in C, call for example the system()
function. Something such as the following piece of code (untested)
should do the job:

  with Interfaces.C.Strings; use Interfaces.C, Interfaces.C.Strings;
  [...]
     function Execute (Command : String) return int is
        C_Command : chars_ptr := New_String (Command);
        function C_System (Command : chars_ptr) return int;
        pragma Import (C, C_System, "system");
        Result : constant int := C_System (C_Command);
     begin
        Free (C_Command);
        return Result;
     end Execute;
        
  Sam
--
Samuel Tardieu -- sam@ada.eu.org




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

* Re: running an exe from gnat
  1997-03-17  0:00 running an exe from gnat Mindy Matusewicz
  1997-03-17  0:00 ` Robert Dewar
  1997-03-17  0:00 ` Samuel Tardieu
@ 1997-03-18  0:00 ` Gautier
  2 siblings, 0 replies; 4+ messages in thread
From: Gautier @ 1997-03-18  0:00 UTC (permalink / raw)



Mindy Matusewicz <Mindy_matusewicz@ny.essd.northgrum.com> writes:
> I am running gnat for windows nt on my pentium and I need to call an exe
> program.  How do you do that in Ada?

Use Spawn proc. in GNAT.OS_lib if I remember well.
This is implemented in the Exec procedure of my DOS package
(it uses only the GNAT library, so it should run under windoze).
You find it in pc_paqs.zip

    http://www.unine.ch/math/Personnel/Assistants/Gautier/Gaut_FTP.htm
                         




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

end of thread, other threads:[~1997-03-18  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-17  0:00 running an exe from gnat Mindy Matusewicz
1997-03-17  0:00 ` Robert Dewar
1997-03-17  0:00 ` Samuel Tardieu
1997-03-18  0:00 ` Gautier

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