Never had a problem from Delphi 3 on and upwards to Delphi XE, I haven't tested in XE2 but I am sure this code works there too.
Maybe the Delphi compiler generates more optimized code that keeps everything in registers and avoids the stack for performance reasons?
I am trying to find a way to do the same in Lazarus. I also tried to make a simple call without any params
(so a simple
asm call proc; end;
)
and does not work either. I think this is a FPC bug.
That’s strange. What kind of procedure are you calling and how is it declared? (calling convention?)
Also: Have you checked what instructions the FPC compiler actually generates? I don’t know if FPC/Lazarus comes with a debugger like the one included in Delphi where you can set a breakpoint somewhere in the source code and then switch to the cpu pane to see the generated
asm code... that would be the easiest way. If there isn’t such a thing, you could always put an
asm int 3; end;
(which acts as a breakpoint) at the beginning of the routine and run it through an ordinary debugger (though it will be more difficult to figure out which opcodes correspond to which instruction in the source code that way). If it really is a bug in FPC, you may spot something here.