How To achieve modular structure in Blitzmax progr

BlitzMax Forums/BlitzMax Programming/How To achieve modular structure in Blitzmax progr

Hi,
When I have a set of modules with interdependencies among the modules how do I achieve the importing of variables only or ability to call functions without multiple global variable or function declarations. For e.g c++ we have #ifdef and #ifndef preprocessor directives.

Regards,
Ramesh

Import only ever imports the file once. However, you can't use it in cycles.

Hi,
Well I thought that import was all I required. I have one problem though if there is a global variable used in two modules during compilation an error pops up in one module saying variable not defined. The variable is declared as global in one of the modules and the modules are all imported into the main module.

Regards,
Ramesh

Take in consideration that each module is 'independent' so a global defined in one module will be only present on modules or applications importing it. If module A has a global called X, and module B needs to read this global, module B has to import module A, even if both of them are already imported in the application. each imported module will see what it imports.