Best ways to take advantage of import

BlitzMax Forums/BlitzMax Programming/Best ways to take advantage of import

Robert Cummings(Posted 2005) [#1]
I can't seem to use import at all, it always cannot find stuff when I'm compiling.

I believe import will cut down on my compile times considerably so I am looking for ways to use it.

Do you have any advice?


TartanTangerine (was Indiepath)(Posted 2005) [#2]
Are you creating and compiling the modules correctly?

Is the module directory structure correct? are you using lowercase characters for the names of files and directories? (you do need to use lowercase).

My structure looks like this (and it works fine).
Program Files
 -/BlitzMax
  -/mod
   -/indiepath.mod
    -/animimagefast.mod
     -/(my compiled animimagefast module)


And my import code :-
Import Indiepath.AnimImageFast 'don't worry about lowercase here!



Yan(Posted 2005) [#3]
Or do you mean the imported code can't find shared variables?

Remember, imported stuff needs to be pretty much self contained as it gets pre-compiled.

You could try having all your modular code included into one file that also holds all the shared variables and import this file into your main code.


skidracer(Posted 2005) [#4]
You could maybe start by splitting your project into two imports, gameengine.bmx and gameplay.bmx with each including their relative files.

I wouldn't bother with this even unless compile times were at least 10 seconds as removing dependencies between files of a single application seems a fruitless endeavour at the best of times.


Robert Cummings(Posted 2005) [#5]
Yep, good advice. I will stick with includes now I know it will be too complicated convert.