Purpose |
Determine if an
| ||||||||||||||||
Syntax |
%DEF({%numeric_equate | $string_equate}) | ||||||||||||||||
Remarks |
The %DEF operator tests whether or not an equate has been defined. If the equate has been defined, %DEF returns TRUE (non-zero); or FALSE (zero) if it has not be defined. PowerBASIC automatically defines the equates in the following table according to the PowerBASIC compiler being used. Please note the references to other PowerBASIC compilers are included for those writing programs that may be compilable by more than one PowerBASIC compiler. | ||||||||||||||||
|
These can be used in conjunction with #IF as a compiler directive to selectively include or exclude code from the compiled file. | ||||||||||||||||
See also |
#IF, Numeric Equates, Built-in numeric equates, String Equates, Built-in string equates | ||||||||||||||||
Example |
' 1. Conditional compilation for PB/CC or PB/Win #IF %DEF(%PB_CC32) 'Assume PB/CC #COMPILE EXE "\PBCC\APPS\MYPROG.EXE" #ELSE 'Assume PB/Win #COMPILE DLL "MYAPP.DLL" #ENDIF
' 2. Conditional compilation for EXE or DLL #IF %PB_EXE ' we are compiling to an EXE (PB/CC or PB/Win) FUNCTION PBMAIN [statements] END FUNCTION #ELSE ' we are compiling to a DLL (PB/Win) FUNCTION PBLIBMAIN [statements] END FUNCTION #ENDIF |