I have been trying to get some work done on a class returned by CreateTextServices, but the differences between windows' stdcall and linux' are giving me a few headaches. right now I've done it pretty much like this:
/* These macros are taken from wine/dlls/msvcrt/cpp.c */ #ifdef __i386__ /* thiscall functions are i386-specific */
#define THISCALL(func) __thiscall_ ## func #define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func) #define DEFINE_THISCALL_WRAPPER(func) \ extern void THISCALL(func)(); \ __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ "popl %eax\n\t" \ "pushl %ecx\n\t" \ "pushl %eax\n\t" \ "jmp " __ASM_NAME(#func) ) #else /* __i386__ */
#define THISCALL(func) func #define THISCALL_NAME(func) __ASM_NAME(#func) #define DEFINE_THISCALL_WRAPPER(func) /* nothing */
#endif /* __i386__ */
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSendMessage); static HRESULT __stdcall fnTextSrv_TxSendMessage(ITextServices *iface, UINT msg, WPARAM wparam, LPARAM lparam, LRESULT* plresult) { .... }
static const ITextServicesVtbl textservices_Vtbl = { fnTextSrv_QueryInterface, fnTextSrv_AddRef, fnTextSrv_Release, THISCALL(fnTextSrv_TxSendMessage), ... };
This works, however it is not clean, it gives me 2 compiler warnings: 1: fnTextServ_TxSendMessage defined but not used 2: initialisation from incompatible pointer type (in the vtable)
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.