Include directive

Format

 * 1) include "Filename"
 * 2) include &lt;Filename&gt;

Description
The  statement causes the compiler to process another file before continuing in the current source file.

If a file is included multiple times, only the first occurrence will be processed. That is a convenient addition to the standard C preprocessor, which DM otherwise emulates quite closely.

The file  is automatically included before all other source code.

Example
 * 1) include "test.dm" // checks ./test.dm
 * 2) include  // checks lib-path/test.dm

BYOND lib Directory
The BYOND lib directory is called  and is located in the BYOND system directory (typically ). If the file is not found there, it also looks in the user lib directory, which would typically be.

Why Manually Include?
Note that the compiler interface allows you to include files graphically by simply clicking the checkbox next to the file. This creates an include statement for you in the  project environment file. The only time you would still want to manually include files is when you need to ensure a certain order of processing. For example, if file overrides procedure definitions of an object defined in, you should include  at the top of. Most other DM code is independent of order, but overriding procedure definitions is not. The compiler will warn you in such cases if you forget.

BYOND Libraries
Another case in which you should manually include files is if you are writing a library to be used by other programmers. Since the file is not distributed with a library, all necessary inclusions must be made in the  files.