[fpc-pascal]Nul sub-routine

Florian Klaempfl florian at klaempfl.de
Tue Sep 26 19:23:27 CEST 2000


IoDream schrieb:
> 
>    OK, that's good ! Thanks !
> 
>    But I would like to do the same with some profiling subroutines. You
> understand: if I compile with the symbol PROFILE defined all the profiling
> code is compiled, and if the symbol is undefined then no extra code is
> generated.
> 
>    Any idea ?

You can use macros. Of course, this requires that you include the
macro definition in all files and compile with -Sm.

{$ifdef profiling}
{$define profile_code:=myprofileprocedure}
{$else profiling}
{$define profile_code:= }
{$endif profiling}

I'am not sure if the docs contain info about macros.

Remark that FPC macros doesn't support parameters as in C. If someone
has to time to implement this, feel free to do so :)....






More information about the fpc-pascal mailing list