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

Attachment: pgp2AKHaBOyRE.pgp
Description: PGP signature

Reply via email to