Err LoadCode(char *fileName, CodeHandle *code);
In order to work correctly with this and associated functions, the executable file being loaded must have been linked with threadstartup.o or subroutinestartup.o instead of the usual cstartup.o.
Give this function the name of the executable file to load, as well as a pointer to a CodeHandle variable, where the handle for the loaded code will be stored. Note, "code" must point to a valid CodeHandle variable; that's where LoadCode()
will put a pointer to the loaded code.
Once you finish using the loaded code, you can remove it from memory by passing the code handle to the UnloadCode()
function.
To execute the loaded code, you must call either the ExecuteAsThread()
function or the ExecuteAsSubroutine()
function. Note that if the loaded code is reentrant, the same loaded code can be spawned multiple times simultaneously as a thread.
LoadProgram
(), UnloadCode(), ExecuteAsThread(), ExecuteAsSubroutine()