You can call an external program using call-system, call-system-showing-output and open-pipe.
You can call C programs using the FLI. See the LispWorks Foreign Language Interface User Guide and Reference Manual .
On Microsoft Windows a COM/Automation interface is provided. See the LispWorks COM/Automation User Guide and Reference Manual . There is also a DDE interface - see Dynamic Data Exchange.
On Mac OS X an Objective-C API is provided. See the LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual .
call-system returns the exit status of the process it created, and potentially a signal number. Similarly pipe-exit-status can query the exit status and signal number associated with a process that was created by open-pipe.
On Unix-like systems when using a string as the command with a typical shell, the exit status is the exit status of the command that is executed. If it is an actual executable (rather than a built-in command) it is the exit status of the process that invoked by this executable. That is not always reliable. In a typical shell you can precede the last command by the word exec
to cause the shell to replace itself by the executable, and then the return value is guaranteed to be from the executable. On Microsoft Windows and when not using string as a command, there is only one process and the exit status is the exit status of this process.
On Unix-like systems, on normal exit the exit status is the argument that was passed to the C function exit
(or _exit
) or the value returned from the main function, and the signal number is nil
. To interpret the normal exit status you need to know what the process does. Normally 0 means success. If the process exited as a result of a signal then the second return value gives the number of the signal.
On Windows, the exit status is either the argument to ExitProcess
or TerminateProcess
, the return value of main
or WinMain
, or an exception value.
LispWorks User Guide and Reference Manual - 13 Feb 2015