This hook is used for parsing the command line arguments. Its prototype must be :
void MainHook ( int * argc , char ** argv )
Use this function to interpret some of the command line arguments. If you want to remove the interpreted arguments from the argv array, don't forget to modify the number of arguments referenced by argc accordingly.
Every remaining parameters are passed to the interpreted Gambas program, that can get them with
the Application.Args
array.
This hook is used for managing the event loop. Its prototype must be :
void LoopHook ( void )
This hook is called just after the startup method of the Gambas program has returned.
The hook must return when the program is ended. The return value of the hook will be the return value of the program.
If no component provided such a hook, then the interpreter will supply itw own event loop. This event loop can just manage watched file descriptors.
This hook is used for implementing the WAIT instruction. Its prototype must be :
=void WaitHook ( long duration )
The hook must wait until duration milliseconds elapse, and must call the event loop during this wait.
The hook can return before the specified duration is elapsed. In that case, the hook will be called
again and again until the duration specified in the WAIT
instruction really elapse.
This hook is called each time a callback routine is posted with the
GB.Post
function. Its prototype must be :
void PostHook ( void )
The aim of this hook is to let the event loop management call each posted callbacks at the end of
the event loop, with the GB.CheckPost
function.
For example, the Post hook of the gb.qt
component initializes a one-shot QTimer that is known to
be called at the end of the loop. When this one-shot QTimer raises its signal, a slot is called
that calls GB.CheckPost
in return.
This hook is called when the QUIT instruction is used. Its prototype must be :
void QuitHook ( void )
Use this hook to release as much objects as possible, so that the interpreter can quit the more cleanly possible.