Hi,

I wanted to ask about $mode global directive scope. According to http://www.freepascal.org/docs-html/prog/progse3.html#x73-710001.2, "Global directives affect the whole of the compilation process". Yet, when I have two units like this:

//prog.pas
{$mode delphi}
program prog;
uses uni;

function func: integer;
begin
  result := 1;
end;

begin
  writeln(func);
end.


//uni.pas
unit uni;

interface
function somefunc: integer;

implementation
function somefunc: integer;
begin
  result:=1;
end;
end.

it fails to compile on uni.pas if I don't use the -Sd switch (because of using result in default fpc mode). So, does the 'whole of the compilation process' apply only to the 'prog.pas' file in this case? This confuses me a bit, but it's maybe just me misunderstanding the docs. Can anybody explain? And a big Thank You for all the work you put in fpc.
Best regards,

David
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to