LoadProgramPrio

Loads a binary image and spawns it as a task, with priority.

Synopsis

Item LoadProgramPrio(char *cmdLine, int32 priority);

Description

This function loads an executable file from disk and launches a new task to execute the code.

You give this function a command line to interpret. The first component of the command line is taken as the name of the file to load. The entirety of the command line is passed to the new task as argc and argv in the main() function. The filename component of the command line specifies either a fully qualified pathname, or a pathname relative to the current directory.

The priority argument specifies the task priority to use for the new task. If you simply want the new task to have the same priority as the current task, use the LoadProgram() function instead. Alternatively, passing a negative priority to this function will also give the new task the same priority as the current task.

If a priority was given to the executable being launched using the modbin utility, then the priority you give to this function is ignored, and the priority that was specified to modbin will be used instead.

Arguments

cmdLine
A NULL-terminated string indicating the file to load as a task. The string may also contain arguments for the task being started.
priority
The task priority for the new task. For user code, this can be in the range 10 to 199.

Return Value

The item number of the newly created task, or a negative error code if the task could not be created.

Implementation

Folio call implemented in file folio V20.

Associated Files

filefunctions.h

See Also

LoadProgram(), LoadCode(), ExecuteAsThread()