$DEFINE compiler directive

$DEFINE Compiler Directive

Top  Previous  Next


The $DEFINE directive is used to associate a value with a symbolic name at compile time. The standard include records in the SYSCOM file contain many examples of $DEFINE.





$DEFINE name value


where name is the symbol to be used in the program and value is a constant.



If the defined name is also a built-in function or statement, that function or statement becomes inaccessible.


The token QM is automatically defined and may be used with $IFDEF to determine whether a program is being compiled on the QM database. The token QM.WINDOWS, QM.LINUX, QM.FREEBSD, QM.MAC, QM.AIX, QM.SOLARIS, QM.RPI or QM.PDA is defined corresponding to the underlying operating system. Because these are only relevant at compile time, take care when using them in programs that may be moved between platforms. The SYSTEM(1010) function can be used to determine platform type at run time.


See $IFDEF for an example of use of define tokens to control conditional compilation, allowing a single source stream to be used in different multivalue environments.



See also: