1 #define WIN32_LEAN_AND_MEAN
8 // This function will reset all the function pointers of a function loaded
9 // by LaodFuncs and will free the DLL instance provided.
20 for (n = 0; fi[n].func_ptr_var; n++)
21 *(fi[n].func_ptr_var) = 0;
22 if (h) FreeLibrary(h);
29 // This function try to load the functions for a DLL. It returns 0 on failure
30 // and non-zero on success. The parameters are descibed below.
37 HINSTANCE* ph, // [out, optional] - DLL handle
38 int* pindex, // [out, optional] - index of last func loaded (-1 if none)
39 int cleanup, // cleanup function pointers and unload on error
40 int go_on, // continue loading even if some functions cannot be loaded
41 int silent // do not pop-up a system dialog if DLL cannot be loaded
51 if (pindex) *pindex = -1;
53 for (n = 0; fi[n].func_ptr_var; n++)
54 *(fi[n].func_ptr_var) = 0;
57 em = SetErrorMode(SEM_FAILCRITICALERRORS);
58 h = LoadLibrary(dll_name);
66 for (i = 0; (go_on || !error) && (i < n); i++)
68 void* p = (void*)GetProcAddress(h, fi[i].func_name);
74 *(fi[i].func_ptr_var) = p;
77 if (pindex) *pindex = last_i;
78 if (error && cleanup && !go_on) {
79 for (i = 0; i < n; i++) {
80 *(fi[i].func_ptr_var) = 0;