To make it easier to develop MapBasic libraries of definitions and modules, you can set environment variables for search paths for Include (.def) files when compiling and Module (.mbo) files when linking. By default, MapBasic will search for these files first in the path specified in your MapBasic code and then under the folder where MapBasic is installed. By setting these environment variables you can specify additional folders to search after the path specified in your code but before the MapBasic folder. The environment variables are called MBINCLUDE and MBMODULE for Include and Module files, respectively, and their values should be set to a semi-colon delimited list of folders to search. MapBasic will search the folders specified and all sub-folders beneath them.
You can set environment variables via the Advanced System Settings on your system. The variables must be set before you run MapBasic for them to be effective.
To set additional search folders for Include files, set the environment variable MBINCLUDE. For example, if you have libraries of .def files in or beneath the folders C:\My MapBasic Library and C:\Work, set the MBINCLUDE environment variable as follows:
Do not use quotes around the folder names even if the path contains spaces.
To set additional search folders for Module files, similarly set the environment variable MBMODULE. For example, if you have libraries of .mbo files in or beneath the folder C:\My MapBasic Library, set the MBMODULE environment variable as follows:
Include “mapbasic.def”
Include “utilities.def”
Include “myapplication.def”
Assuming you set your environment variables as above, when compiling MapBasic will search for these .def files first in the folder where the file your are compiling is located, then under C:\My MapBasic Library and its subfolders, next under C:\Work and its subfolders, and last under the folder where MapBasic was installed. If the file utilities.def, for example, is used by multiple applications you’ve written you can put it somewhere under C:\My MapBasic Library or C:\Work and MapBasic can find it without you having to specify the path in the code.
[Link]Application=myapplication.mbx
Module=myapplication.mbo
Module=library.mbo
If the file library.mbo, for example, is used by multiple applications you’ve written you can put it somewhere under C:\My MapBasic Library and MapBasic can find it without you having to specify the path in the project file.