一般的调用方式的申明约定有以下这几种:
Register
Pascal
Cdecl
Stdcall
Safecall
Fastcall
Windows的API使用stdcall模式。
默认情况下,我们采用cdecl申明模式:
Function TS_strtofloat(s:string):double;external "tslkrnl.dll" name "TS_strtofloat";
等同于:
Function TS_strtofloat(s:string):double;cdecl;external "tslkrnl.dll" name "TS_strtofloat";
除了Win32以外,每种CPU架构下只有一套标准调用模式,不需考虑是stdcall还是cdecl。目前只有Win32还需要考虑调用方式的申明。