LynPlex Pre-processor

Preprocessor commands used to control what gets compiled and how. They can be used to choose to compile one block of code rather than another for cross-platform compatibility, include headers or other source files, define small inline functions called macros, or alter how the compiler handles variables.

Preprocessor Commands

There are four categories of preprocessor commands:

  • Conditional Compilation
    Commands that allow for branches in compilation based on conditions.
  • Text Replacement
    Commands that create text-replacement macros.
  • File Directives
    Commands that indicate to the compiler how other files relate to the source file.
  • Control Directives
    Commands that set compile options, control compilation, and report compile time information.

Conditional Compilation

  • if
    Compiles the following code block based on a condition.
  • ifdef
    Compiles the following code block if a symbol is defined.
  • ifndef
    Compiles the following code block if a symbol is not defined.
  • elseif
    Compiles the following code block if a condition is true and the previous conditions was false.
  • else
    Compiles the following code block if previous conditions were false.
  • endif
    Signifies the end of a code block.
  • defined
    Returns “-1” if a symbol is defined, otherwise “0”.

Text Replacement

File Directives

  • include
    Inserts text from a file.
  • inclib
    Includes a library in the linking processes.
  • libpath
    Includes a path to search for libraries in the linking process.

Control Directives

  • pragma
    Sets compiling options.
  • lang
    Sets dialect from source.
  • print
    Outputs a messages to standard output while compiling.
  • error
    Outputs a messages to standard output and stops compilation.
  • line
    Sets the current line number and file name.

Index


lynplexp/start.txt · Last modified: 2011/09/08 16:07 (external edit)