WileLib: Retrurning function pointers

Marcus Meissner meissner at suse.de
Mon Jun 27 07:00:38 CDT 2005


On Mon, Jun 27, 2005 at 11:53:34AM +0200, Giuseppe AMATO wrote:
> 
> Hi,
> 
> I'm having big troubles using function pointers.
> 
> Shortly:
> 
> I'm trying to build a Winelib compatible DLL that returns function 
> pointers; that pointers must be used by a WIN32 app that runs under Wine.
> The problem is that the returned function pointers, when directly used 
> by the WIN32 code, crash the application:
> "wine: Unhandled exception (thread 0009), starting debugger..."

Very likely you have a mixup between stdcall and cdecl calling
convention.


> In details:
> 
> For instance the DLL is a PKCS#11 library.
> The PKCS#11 function C_GetFunctionList() returns a structure that 
> contains pointers to all PKCS#11 functions (so you need to export/use 
> just the C_GetFunctionList symbol)
> 
> struct CK_FUNCTION_LIST
> {
> 	CK_C_Initialize C_Initialize;
> 	CK_C_Finalize C_Finalize;
> 	CK_C_GetInfo C_GetInfo;
> 	...
> };
> CK_RV C_GetFunctionList(CK_FUNCTION_LIST_PTR_PTR ppFunctionList);
> ...
> 
> All function have cdecl calling convention.

Are you sure? Do even the win32 version have cdecl calling convention?

Ciao, Marcus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20050627/f6b32179/attachment.pgp


More information about the wine-devel mailing list