aboutsummaryrefslogtreecommitdiff
path: root/win32/lazyload.h
diff options
context:
space:
mode:
Diffstat (limited to 'win32/lazyload.h')
-rw-r--r--win32/lazyload.h16
1 files changed, 2 insertions, 14 deletions
diff --git a/win32/lazyload.h b/win32/lazyload.h
index a9fcff209..034bc7e45 100644
--- a/win32/lazyload.h
+++ b/win32/lazyload.h
@@ -21,19 +21,7 @@ struct proc_addr {
21#define INIT_PROC_ADDR(dll, function) \ 21#define INIT_PROC_ADDR(dll, function) \
22 (function = get_proc_addr(#dll, #function, &proc_addr_##function)) 22 (function = get_proc_addr(#dll, #function, &proc_addr_##function))
23 23
24static inline void *get_proc_addr(const char *dll, const char *function, struct proc_addr *proc) 24void *get_proc_addr(const char *dll, const char *function,
25{ 25 struct proc_addr *proc);
26 /* only do this once */
27 if (!proc->initialized) {
28 HANDLE hnd = LoadLibraryExA(dll, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
29 if (hnd)
30 proc->pfunction = GetProcAddress(hnd, function);
31 proc->initialized = 1;
32 }
33 /* set ENOSYS if DLL or function was not found */
34 if (!proc->pfunction)
35 errno = ENOSYS;
36 return proc->pfunction;
37}
38 26
39#endif 27#endif