Next: Adapting your applications to
Up: Miscellaneous
Previous: Spawning
  Contents
DICE_function
Sometimes is desirable to run a different function in each client,
such as in CAVE systems, where each node will render a different view.
DICElib provides this functionality, letting each machine have a special
function, which can be accessed by calling:
-
- int DICE_function(void *data);
This special function is a pointer to the function you provided in
the dicerc file (see section 2.2), and is automatically
setup upon spawning. If no special function was set and you call DICE_function,
it will return -1. See the tests/around.c file for an example of how
special functions work.
DICElib needs a little help from you to find the functions. You must
declare the following variable:
-
- DICE_Function DICE_MyFunctions[] = {
-
- { "func1_name", func1 },
{ "func2_name", func2 },
{ NULL, NULL }
};
You may provide any number of functions, whether they are used or
not by the dicerc file. Important: always finish the array
with { NULL, NULL }. Failure to do so will lead to a segmentation
fault. If you don't need DICE_function, declare:
-
- DICE_no_functions;
as if it were a global variable.
See the tests/ subdirectory for some examples.
Next: Adapting your applications to
Up: Miscellaneous
Previous: Spawning
  Contents
2001-12-09