Forum > Options

Compiler options fail to replicate fpc -Mtp

<< < (2/3) > >>

Anonymous:
The code is

Procedure SetInterrupts(IntHandler: Pointer; InterruptFrequency: Single);
Begin
   Asm
      CLI;   //Inline($FA);                         {CLI - disable interrupts during vector change}
   end;
   If (IntHandler <> @RUSHandler) then

I keep getting Error: Incompatible types: got "<address of procedure(Word, Word, Word, Word, Word, Word...); Register>" exptected "LongInt"

Thanks.

Vincent Snijders:
I still can't even try to compile this code. Can you give a complete example  including variable and type declarations?

Marc:
I can reproduce it with the following app:
--- Code: ---
program a;


procedure RUSHandler(a,b,c,d,e,f: Word);
begin
end;

Procedure SetInterrupts(IntHandler: Pointer; InterruptFrequency: Single);
Begin
  Asm
    CLI; //Inline($FA); {CLI - disable interrupts during vector change}
  end;
  If (IntHandler <> @RUSHandler) then
end;

begin
end.

--- End code ---


When you compile like this, without specifying mode, fpc compiles in its native fpc mode. This mode is similar to tp.
Somehow the result of @ is typed on comparisations.

As a workaround you can typecast: -> Pointer(@RUSHandler)

For a better explanation, you can thry the fpc forum or the fpc mailinglist, since this is not realy a lazarus issue (and I'm not that deep into the fpc internals of different modi)

Ed:
Thanks.  My point was that the snippet of code I gave (more complete code is like that proposed by Marc) compiles just fine with the command line

fpc -Mtp source.pas

but does not with Lazarus when I specify the -So compile option, which is supposed to be equivalent to -Mtp.  I wanted to know how to perfectly replicate fpc -Mtp to successfully compile my source from within Lazarus.

Vincent Snijders:
Thanks, Marc, for the complete example. Now, at least, I can reproduce the problem and see for myself that your example code only needs the -So parameter (and that it is equivalent to -Mtp). No need to change the code.

I cannot reproce the problems Ed is having, because I cannot compile his snippet

--- Code: ---project1.pas(9,20) Error: Identifier not found "RUSHandler"
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version