Include or Import?

BlitzMax Forums/BlitzMax Beginners Area/Include or Import?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Include works as if the files you are including were part of the same, very large file. That is, when you compile, it replaces the Include line with the contents of the file you are including.

Importing on the otherhand keeps the source separate at compile time, instead linking each compiled section together. This has benefits in that depending on which files you've made changes to, only the changes need to be re-compiled, and therefore speeding up the compile time significantly.
One issue with Importing is its inability to support cyclic imports, where A imports B imports A. You might find you need to do that if a Type in A referred to a Type in B, and vice versa. However, more often than not, a change to your code logic can get around that problem.

I use imports exclusively :-)