How To achieve modular structure in Blitzmax progr

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

gameshastra(Posted 2007) [#1]
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


Otus(Posted 2007) [#2]
Import only ever imports the file once. However, you can't use it in cycles.


gameshastra(Posted 2007) [#3]
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


ziggy(Posted 2007) [#4]
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.