If you make a set of functions you regulary use in most of your programs, you can put all them on a file, and import this file on any program that needs those functions.
As a side note, when you create an exe, there are 2 parts involved:
-compiling the source code
-linking the program
the first part (compiling) can take a while if your program is very big, linking is ussually a lot faster.
When using an imported file. The compilation part for this file doesn't have to be redone unless this file is changed.
Example:
1.- File1.bmx includes file2.bmx
2.- I compile my program for the first time so:
3.- File2.bmx is included inside file1 before compiling
4.- File1.bmx + file2.bmx is compiled
5.- The program is linked
6.- I get the EXE
Then I modify file1.bmx and want to make the exe again:
1.- File1.bmx includes file2.bmx
2.- I compile my program again:
3.- File2.bmx is included in file1 before compiling
4.- File1.bmx + file2.bmx is compiled
5.- The whole program is linked
6.- I get the EXE
Then I modify file2.bmx and want to make the exe again:
1.- File1.bmx includes file2.bmx
2.- I compile my program again:
3.- File2.bmx is included in file1 before compiling
4.- File1.bmx + file2.bmx is compiled
5.- The whole program is linked
6.- I get the EXE
The same example using imports:
Example:
1.- File1.bmx IMPORTS file2.bmx
2.- I compile my program for the first time so:
3.- File2.bmx is compiled
4.- File1.bmx is compiled
5.- The program is linked
6.- I get the EXE
Then I modify file1.bmx and want to make the exe again:
1.- File1.bmx IMPORTS file2.bmx
2.- I compile my program again:
3.- File1.bmx is compiled
4.- The whole program is linked using the old compilation of file2, as the file2 source has not changed since last compilation.
5.- I get the EXE
Then I modify file2.bmx and want to make the exe again:
1.- File1.bmx IMPORTS file2.bmx
2.- I compile my program again:
3.- File2.bmx is compiled
4.- The whole program is linked using the old compilation of file1, as the file1 source has not changed since last compilation.
5.- I get the EXE
Imagine file2.bmx has a lot of functions I usually put in my programs, only the first program to import this file compiles it, all the others only need to link it (unless modified again, wich is automatically detected by blitzmax, so no worries.)
As a side note, when you create an exe, there are 2 parts involved:
-compiling the source code
-linking the program
the first part (compiling) can take a while if your program is very big, linking is ussually a lot faster.
When using an imported file. The compilation part for this file doesn't have to be redone unless this file is changed.
Example:
1.- File1.bmx includes file2.bmx
2.- I compile my program for the first time so:
3.- File2.bmx is included inside file1 before compiling
4.- File1.bmx + file2.bmx is compiled
5.- The program is linked
6.- I get the EXE
Then I modify file1.bmx and want to make the exe again:
1.- File1.bmx includes file2.bmx
2.- I compile my program again:
3.- File2.bmx is included in file1 before compiling
4.- File1.bmx + file2.bmx is compiled
5.- The whole program is linked
6.- I get the EXE
Then I modify file2.bmx and want to make the exe again:
1.- File1.bmx includes file2.bmx
2.- I compile my program again:
3.- File2.bmx is included in file1 before compiling
4.- File1.bmx + file2.bmx is compiled
5.- The whole program is linked
6.- I get the EXE
The same example using imports:
Example:
1.- File1.bmx IMPORTS file2.bmx
2.- I compile my program for the first time so:
3.- File2.bmx is compiled
4.- File1.bmx is compiled
5.- The program is linked
6.- I get the EXE
Then I modify file1.bmx and want to make the exe again:
1.- File1.bmx IMPORTS file2.bmx
2.- I compile my program again:
3.- File1.bmx is compiled
4.- The whole program is linked using the old compilation of file2, as the file2 source has not changed since last compilation.
5.- I get the EXE
Then I modify file2.bmx and want to make the exe again:
1.- File1.bmx IMPORTS file2.bmx
2.- I compile my program again:
3.- File2.bmx is compiled
4.- The whole program is linked using the old compilation of file1, as the file1 source has not changed since last compilation.
5.- I get the EXE
Imagine file2.bmx has a lot of functions I usually put in my programs, only the first program to import this file compiles it, all the others only need to link it (unless modified again, wich is automatically detected by blitzmax, so no worries.)