summaryrefslogtreecommitdiff
path: root/src/os/windows/win32.cpp
diff options
context:
space:
mode:
authorglx22 <glx@openttd.org>2021-05-14 15:26:03 +0200
committerLoïc Guilloux <glx22@users.noreply.github.com>2021-06-10 23:17:29 +0200
commit744a9e474575af90935807620bff860c02559d76 (patch)
tree1c9dc114fb609d12cc9faffd16e88f177696dd13 /src/os/windows/win32.cpp
parent15f66329c28cb0aa3107dbb8da71281b1501be6b (diff)
downloadopenttd-744a9e474575af90935807620bff860c02559d76.tar.xz
Codechange: [WIN32] Add a wrapper around GetProcAddress()
Diffstat (limited to 'src/os/windows/win32.cpp')
-rw-r--r--src/os/windows/win32.cpp27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp
index 4478caa65..788021008 100644
--- a/src/os/windows/win32.cpp
+++ b/src/os/windows/win32.cpp
@@ -50,30 +50,6 @@ bool MyShowCursor(bool show, bool toggle)
return !show;
}
-/**
- * Helper function needed by dynamically loading libraries
- */
-bool LoadLibraryList(Function proc[], const char *dll)
-{
- while (*dll != '\0') {
- HMODULE lib;
- lib = LoadLibrary(OTTD2FS(dll).c_str());
-
- if (lib == nullptr) return false;
- for (;;) {
- FARPROC p;
-
- while (*dll++ != '\0') { /* Nothing */ }
- if (*dll == '\0') break;
- p = GetProcAddress(lib, dll);
- if (p == nullptr) return false;
- *proc++ = (Function)p;
- }
- dll++;
- }
- return true;
-}
-
void ShowOSErrorBox(const char *buf, bool system)
{
MyShowCursor(true);
@@ -679,7 +655,8 @@ int OTTDStringCompare(const char *s1, const char *s2)
#endif
if (first_time) {
- _CompareStringEx = (PFNCOMPARESTRINGEX)GetProcAddress(GetModuleHandle(L"Kernel32"), "CompareStringEx");
+ static DllLoader _kernel32(L"Kernel32.dll");
+ _CompareStringEx = _kernel32.GetProcAddress("CompareStringEx");
first_time = false;
}