Darwin Help

Back to Index

CallExternal

Function CallExternal - call an external (typically written in C) function

Calling Sequence  CallExternal(prgname,arg1,...)
Parameters
NameTypeDescription

prgname stringname of the external executable
arg1 anythingfirst argument passed to the called program
Return Type  anything
Synopsis Calls an executable program passing parameters in shared memory. This is the mechanism of choice to implement a function which is very CPU intensive. Alternatively it may be used when some program has already been written and we want to use it within Darwin. Currently, the only language fully supported for writing a program callable by Darwin is C. There is a mechanism to pass parameters from Darwin to the called program and back based on macros. These macros are in the file "lib/externs.h" in the Darwin distribution. The macros file contains comments on the use of the functions provided for the interface. An external function should be compiled additionally with the file "lib/externs.c". If you intend to write programs callable by Darwin you should become familiar with these macros. If the macro "_DEGUG" is defined, then extra code is added to check that all the accesses to parameters is correct. It is highly recommended that the skeleton of the program to be written in C, be written in Darwin and then processed with the function "CreateCProgram". This will be very helpful in building all the parameter-passing infrastructure.
See also CreateCProgram