.686
.model flat,fastcall
option casemap:none
Fast struct
wParam dword ?
lParam dword ?
;Structure member name "wParam" or "lParam"
;parameter name "wParam" or "lParam"
; used stdcall is ok
; used fastcall is error
Fast ends
FastCallTestA PROTO FASTCALL wParam:DWORD,lParam:DWORD
;i don't know ..........about the proto This is wrong?
;jwasm -> Error A2168: General Failure
;but "FastCallTestA" in front of "WinMain" doesn't require declarations. build is ok
.code
align 16
WinMain proc stdcall
INVOKE FastCallTestA,12,12
ret
WinMain endp
align 16
FastCallTestA proc uses esi edi wParam:DWORD,lParam:DWORD
mov esi,wParam
mov edi,lParam
lea eax,dword ptr[esi+edi]
ret
FastCallTestA endp
align 16
;////////////////////////////////////////////////////////////////////////
FastCallTest proc wParam,lParam
local stFast:Fast
lea eax,stFast
; mov ecx,(Fast ptr[eax]).wParam
;error mov ecx,(Fast ptr[eax]).ecx
;mov ecx,(Fast ptr[eax]).lParam
;error mov ecx,(Fast ptr[eax]).edx
ret
FastCallTest endp
StdCallTest proc stdcall wParam,lParam
local stFast:Fast
lea eax,stFast
mov ecx,(Fast ptr[eax]).wParam
mov ecx,(Fast ptr[eax]).lParam
;this ok
StdCallTest endp
;///////////////////////////////////////////////////////////////////////
end WinMain
I can reproduce the "General Failure" problem - it's a regression in v2.10-2.11.
Workaround: try using jwasm v2.09!
The "invalid use of register" error when accessing struct members wParam/lParam cannot be avoided, though. It's due to how fastcall parameters are implemented - they're implemented as "local" text macros, which are expanded by the preprocessor - and there's no way currently to tell the preprocessor that it should handle such macros slightly differently than "global" macros.