Wrapping around stdcall
Maarten Lankhorst
m.b.lankhorst at gmail.com
Tue Jul 5 17:54:05 CDT 2005
Marcus Meissner schreef:
>On Tue, Jul 05, 2005 at 10:16:08PM +0200, Felix Nawothnig wrote:
>
>
>>Marcus Meissner wrote:
>>
>>
>>>>I wonder how I can do this cleaner (Meaning no compiler warnings without
>>>>ugly hacks). Also I would like to know how to call a function like
>>>>__thiscall_fnTextSrv_TxSendMessage, because some methods I need are
>>>>implemented in windows' stdcall. And I would like to know wether
>>>>include/textserv.h needs to be adjusted now that I know they are not
>>>>WINAPI.
>>>>
>>>>
>>>Adding "thiscall" to gcc would perhaps help in the long run ... :/ Fun fun
>>>fun...
>>>
>>>
>>Considering that gcc already knows regparm and we just need regparm(1)
>>with ecx instead eax hacking in "thiscall" for C code shouldn't be too
>>hard I think.
>>
>>But since this would be a very Wine-specific hack I doubt it would get
>>into GCC. The right way would probably to extend the regparm attribute
>>to allow specifying arbitrary registers...
>>
>>
>
>On second thought... What about abusing the "regparm(3)" attribute for this.
>
>It gets eax, edx, ecx, stackparam1, stackparam2, ...
>
>So what about using a construct like this (cloaked in some macros)?
>
>#define THISCALL0(name,this) __thiscall_#name(int unused_eax,int unused_edx, void *this)
>
>#define THISCALL1(name,this,p1) __thiscall_#name(int unused_eax,int unused_edx, void *this, int p1)
>
It looks evil, and those functions are not exactly what I want, because
I need them in a vtable, which requires them to be something like
HRESULT ... fnTextServ_blah(ITextServices *iface, args), I could recast
those functions, but that is not exactly a 'clean' solution, adding
'thiscall' to gcc would definitely help a lot. Until gcc supports
thiscall, I think it would be easier to just fix the macro's I already
have and set attribute 'used' to avoid compiler warnings. But I still
wonder what I have to do to call a 'thiscall' function, since I probably
need it in ITextHost.
Maarten Lankhorst
More information about the wine-devel
mailing list