Hello,
The title says it all but, here are some details. Note: the following applies to 32bit. In func.inc "CompareFileTime" is defined as follows (note the absence of "stdcall").
function CompareFileTime(lpFileTime1:LPFILETIME;
lpFileTime2:LPFILETIME):LONG;
external 'kernel32' name 'CompareFileTime';
In the process of "porting" some Delphi 2.0 programs, I ran into the fact that Delphi 2.0 has a different definition for that function and proceeded to make one that I thought was equivalent from a copy/paste of FPC's original definition. I ended up with this:
function CompareFileTime(constref lpFileTime1:TFILETIME;
constref lpFileTime2:TFILETIME):LONG;
external 'kernel32' name 'CompareFileTime';
which promptly rewarded me with a SIGSEGV.
Inspecting the assembly code revealed that my definition was passing the parameters in registers instead of on the stack. Adding "stdcall" to the definition solved the problem.
What I am puzzled about is that the definition in "func.inc" does _not_ state "stdcall" yet, it works. What compiler directive (or anything else) caused the compiler to automatically consider the definition "stdcall" ?
(Note: I do not have any compiler mode set in the program - only directive present is {$APPTYPE GUI}) Also, this is under Win7 64bit, using FPC v3.0.4.
Thank you for your help.