Tim Wong wrote:
I'm trying to create a function list to be able to be returned in C_GetFunctionList. The code looks something like the following:CK_FUNCTION_LIST FunctionList = { {2,0}, &C_Initialize , &C_Finalize, &C_GetInfo, ... &C_GenerateRandom, &C_GetFunctionStatus, &C_CancelFunction };
Try the following code snipit.
static const CK_FUNCTION_LIST sftk_funcList = {
{ 2, 0 },
#undef CK_PKCS11_FUNCTION_INFO
#undef CK_NEED_ARG_LIST
#define CK_PKCS11_FUNCTION_INFO(func) func,
#include "pkcs11f.h"
};
Also, it you are running on some platforms like solaris where the
platform may map all global symbols together (that is if some
application has loaded a library with C_Initialize() defined before you,
your library will call that C_Initialize rather than your internal
version), you may want to separate you public API symbols from your
functiontable.
CKR_RV C_Initialize(....) {
return timWongC_Initialize(...);
}
...
Implement timWongC_Initialize();
Then your function list would look lie:
static const CK_FUNCTION_LIST sftk_funcList = {
{ 2, 0 },
#undef CK_PKCS11_FUNCTION_INFO
#undef CK_NEED_ARG_LIST
#define CK_PKCS11_FUNCTION_INFO(func) \
__PASTE(timWong,func),
#include "pkcs11f.h"
};
This used to compile fine in VC++ 6.0, but when I tried to convert my
project to C++ .NET...I am getting the following errors:
c:\Projects\PKCS11\common source\PKCS11Def.cpp(16) : error C2440:
'initializing' : cannot convert from 'CK_RV (__stdcall *)(CK_VOID_PTR)'
to 'CK_C_Initialize'
This conversion requires a reinterpret_cast, a C-style cast or
function-style cast
c:\Projects\PKCS11\common source\PKCS11Def.cpp(16) : error C2440:
'initializing' : cannot convert from 'CK_RV (__stdcall *)(CK_VOID_PTR)'
to 'CK_C_Finalize'
This conversion requires a reinterpret_cast, a C-style cast or
function-style cast
and on and on....
Any ideas?
_______________________________________________
mozilla-crypto mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-crypto
smime.p7s
Description: S/MIME Cryptographic Signature
