$NOMAIN directive
Purpose: Creates program with no main() function.
BCX usually creates the "C" main() function. $NOMAIN is useful for creating a library of compiled code modules that do not contain a main function. $NOMAIN also can be used if you want to code your own main() function.
Place the $NOMAIN directive near the top of the source code file.
Here is a simple example which also demonstrates a method of forcing a variable to be declared in the main() procedure.
$NOMAIN SUB MAIN() DIM RAW i i = 10 PRINT i END SUB