10 #include "../../stdafx.h"
14 #include "../../library_loader.h"
15 #include "../../3rdparty/fmt/format.h"
17 #include "../../safeguards.h"
19 static std::string GetLoadError()
21 auto error_code = GetLastError();
24 if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, error_code,
25 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer,
lengthof(buffer),
nullptr) == 0) {
26 return fmt::format(
"Unknown error {}", error_code);
34 void *h = ::LoadLibraryW(
OTTD2FS(filename).c_str());
36 this->
error = GetLoadError();
53 void *p =
reinterpret_cast<void *
>(::GetProcAddress(
handle, symbol_name.c_str()));
55 this->
error = GetLoadError();