[fpc-pascal] Proper preprocessor?

Marcos Douglas B. Santos md at delfire.net
Fri Jun 22 23:10:32 CEST 2018


On Fri, Jun 22, 2018 at 5:13 PM, Florian Klämpfl <florian at freepascal.org> wrote:
>
> {$macro on}
>
> {$define TypeStr:=specialize _TypeStr}
>
> begin
>   Writeln(TypeStr<TMyRecord>);
> end.

Can I use the same idea but for units?

Like this:

{$macro on}

uses
  {$ifdef debug}
    foo_debug
    {$define foo := foo_debug}
  {else}
    foo_run;
    {$define foo := foo_run}
 {$enfif}

begin
  foo.SomeFunc;
end;



More information about the fpc-pascal mailing list