Module writing hints
Module debugging
When debugging a module, you can create another dummy module earlier in the module list with something like this in its header:
#define DEBUG_MYMODULE
Then, in the real module that you are working on, surround debug code with:
#ifdef DEBUG_MYMODULE // debug code, e.g. Display or labelDebug.Text=something #endif
then, if you export the module and forget to remove the debug code, it won't affect the running of the module.
Calling a user-defined function from a module
If you want to call a function that can have a default function, included in the module, but also want the user to be able to rewrite just that function, without having to edit your module then you can use this technique:
surround the default function with:
#ifndef MyModule_CustomFunction function my_dialog_request (int arg) { // etc... } #endif
then, also provide an example module with a custom function in it:
function my_dialog_request (int arg) { // etc... custome version } #define MyModule_CustomFunction
which must come before the main module in the module list. This will allow the custom module to override the default if it exists, but if it is not there then the default is used. This might be used, for example, in an icon-based dialog module or similar.