[fpc-pascal] Interface with NASM

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Sep 16 15:19:39 CEST 2010


On 14 Sep 2010, at 08:35, leledumbo wrote:

> build command:
> nasm -f coff test.asm
> fpc asmio.pas
> fpc -o test driver.pas
>
> As you can see, I didn't use any optimizations because AFAIR FPC would
> change parameter passing mechanism when a certain optimizations are
> performed.

That's not the case. The only situation in which the compiler would be  
allowed to do that is for routines defined in the main program or in  
the implementation section of a unit that are not manually declared as  
public/export either (in your case they're both in the interface of a  
unit and manually declared as public), and for safety that maybe also  
are not called from inline assembler blocks (but it doesn't do that at  
this time).

> Of course if it works I won't ask here, but it doesn't. I got
> access violation instead.

It works fine under linux (if you replace the "-f coff" with "-f elf").


Jonas



More information about the fpc-pascal mailing list