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