Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-06

scope of defining $mode

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

David Pethes

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