1*7f2fe78bSCy Schubert #ifndef __LOADFUNCS_H__ 2*7f2fe78bSCy Schubert #define __LOADFUNCS_H__ 3*7f2fe78bSCy Schubert 4*7f2fe78bSCy Schubert #ifdef __cplusplus 5*7f2fe78bSCy Schubert extern "C" { 6*7f2fe78bSCy Schubert #endif 7*7f2fe78bSCy Schubert 8*7f2fe78bSCy Schubert #include <windows.h> 9*7f2fe78bSCy Schubert 10*7f2fe78bSCy Schubert typedef struct _FUNC_INFO { 11*7f2fe78bSCy Schubert void** func_ptr_var; 12*7f2fe78bSCy Schubert char* func_name; 13*7f2fe78bSCy Schubert } FUNC_INFO; 14*7f2fe78bSCy Schubert 15*7f2fe78bSCy Schubert #define DECL_FUNC_PTR(x) FP_##x p##x 16*7f2fe78bSCy Schubert #define MAKE_FUNC_INFO(x) { (void**) &p##x, #x } 17*7f2fe78bSCy Schubert #define END_FUNC_INFO { 0, 0 } 18*7f2fe78bSCy Schubert #define TYPEDEF_FUNC(ret, call, name, args) typedef ret (call *FP_##name) args 19*7f2fe78bSCy Schubert 20*7f2fe78bSCy Schubert void 21*7f2fe78bSCy Schubert UnloadFuncs( 22*7f2fe78bSCy Schubert FUNC_INFO fi[], 23*7f2fe78bSCy Schubert HINSTANCE h 24*7f2fe78bSCy Schubert ); 25*7f2fe78bSCy Schubert 26*7f2fe78bSCy Schubert int 27*7f2fe78bSCy Schubert LoadFuncs( 28*7f2fe78bSCy Schubert const char* dll_name, 29*7f2fe78bSCy Schubert FUNC_INFO fi[], 30*7f2fe78bSCy Schubert HINSTANCE* ph, // [out, optional] - DLL handle 31*7f2fe78bSCy Schubert int* pindex, // [out, optional] - index of last func loaded (-1 if none) 32*7f2fe78bSCy Schubert int cleanup, // cleanup function pointers and unload on error 33*7f2fe78bSCy Schubert int go_on, // continue loading even if some functions cannot be loaded 34*7f2fe78bSCy Schubert int silent // do not pop-up a system dialog if DLL cannot be loaded 35*7f2fe78bSCy Schubert ); 36*7f2fe78bSCy Schubert 37*7f2fe78bSCy Schubert #ifdef __cplusplus 38*7f2fe78bSCy Schubert } 39*7f2fe78bSCy Schubert #endif 40*7f2fe78bSCy Schubert 41*7f2fe78bSCy Schubert #endif /* __LOADFUNCS_H__ */ 42