/* arquivo definindo o PKCS11 */ /* All the various Cryptoki types and #define'd values are in the * file pkcs11t.h. */ #include "pkcs11t.h" #define __PASTE(x,y) x##y /* ============================================================== * Define the "extern" form of all the entry points. * ============================================================== */ #define CK_NEED_ARG_LIST 1 #define CK_PKCS11_FUNCTION_INFO(name) \ extern CK_DECLARE_FUNCTION(CK_RV, name) /* pkcs11f.h has all the information about the Cryptoki * function prototypes. */ #include "pkcs11f.h" #undef CK_NEED_ARG_LIST #undef CK_PKCS11_FUNCTION_INFO /* ============================================================== * Define the typedef form of all the entry points. That is, for * each Cryptoki function C_XXX, define a type CK_C_XXX which is * a pointer to that kind of function. * ============================================================== */ #define CK_NEED_ARG_LIST 1 #define CK_PKCS11_FUNCTION_INFO(name) \ typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name)) /* pkcs11f.h has all the information about the Cryptoki * function prototypes. */ #include "pkcs11f.h" #undef CK_NEED_ARG_LIST #undef CK_PKCS11_FUNCTION_INFO /* ============================================================== * Define structed vector of entry points. A CK_FUNCTION_LIST * contains a CK_VERSION indicating a library's Cryptoki version * and then a whole slew of function pointers to the routines in * the library. This type was declared, but not defined, in * pkcs11t.h. * ============================================================== */ #define CK_PKCS11_FUNCTION_INFO(name) \ __PASTE(CK_,name) name; struct CK_FUNCTION_LIST { CK_VERSION version; /* Cryptoki version */ /* Pile all the function pointers into the CK_FUNCTION_LIST. */ /* pkcs11f.h has all the information about the Cryptoki * function prototypes. */ #include "pkcs11f.h" }; #undef CK_PKCS11_FUNCTION_INFO #undef __PASTE #ifdef __cplusplus } #endif #endif /*Esse segundo arquivo contém todas as funções a serem exportadas pela dll. * Coloquei apenas as funções de uso geral, pois o resto se repete e ficaria muito * grande no tópico. É esse o arquivo que está dando problema. Se eu tentar incluí-* lo no meu projeto( estou usando como compilador e editor o VC7.0 ) dá pau.Ele * diz que as funções não estão definidas. Os erros, para cada uma das funções *são esses. *error C2501: 'CK_PKCS11_FUNCTION_INFO' : missing storage-class or type *specifiers * error C2440: 'initializing' : cannot convert from 'CK_RV (__cdecl *) * (CK_VOID_PTR)' to 'int' * error C2146: syntax error : missing ';' before * identifier 'CK_PKCS11_FUNCTION_INFO' * error C2501: 'CK_PKCS11_FUNCTION_INFO' : missing storage-class or type * specifiers * error C2374: 'CK_PKCS11_FUNCTION_INFO' : redefinition; multiple initialization * e então esses erros se repetem para cada uma das outras funções do arquivo de funções a serem exportadas pela dll. */ /* General-purpose */ /* C_Initialize initializes the Cryptoki library. */ CK_PKCS11_FUNCTION_INFO(C_Initialize) #ifdef CK_NEED_ARG_LIST ( CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets * cast to CK_C_INITIALIZE_ARGS_PTR * and dereferenced */ ); #endif /* C_Finalize indicates that an application is done with the * Cryptoki library. */ CK_PKCS11_FUNCTION_INFO(C_Finalize) #ifdef CK_NEED_ARG_LIST ( CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */ ); #endif /* C_GetInfo returns general information about Cryptoki. */ CK_PKCS11_FUNCTION_INFO(C_GetInfo) #ifdef CK_NEED_ARG_LIST ( CK_INFO_PTR pInfo /* location that receives information */ ); #endif /* C_GetFunctionList returns the function list. */ CK_PKCS11_FUNCTION_INFO(C_GetFunctionList) #ifdef CK_NEED_ARG_LIST ( CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to * function list */ ); #endif No arquivo aonde eu vou implementar as funções eu dou um include nesses dois .h, mas outros 2, um que contém os tipos e as estruturas, e um outro que garante as conveções de chamada e define o entry point para uma dll windows. Se eu incluo esse aquivo que eu postei por ultimo, dá pau. É basicamente isso que está acontecendo. Valeu pela ajuda, quem tiver a manha de resolver.