2010. november 21., vasárnap
Debugging with conditional compiler directive
Problem/Question/Abstract:
How to use compiler directive {$IFOPT switch} for debugging ?
Answer:
The usual way of using the compiler directive is to first define using {$define debug} and use $IFDEF and $ENDIF
The method given below is similar with an additional advantage.
For example you can use the following code for debugging with GExperts
{$IFOPT D+}, DbugIntf{$ENDIF} //in the uses
{$IFOPT D+}
SendDebug('Data=' + InttoStr(TestVAlue));
//whenever you require to display to the GExperts debug window
{$ENDIF}
The advantage of using $IFOPT D+ is that, the debug statements are automatically removed once you remove the debug info in the project option properties(Project Options->Compiler ->Debugging) .
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése