| 318 | |
| 319 | namespace dll { |
| 320 | void *open(std::string_view path) |
| 321 | { |
| 322 | std::wstring wpath = utf8_to_wstring(path); |
| 323 | void *sym = ::LoadLibraryW(wpath.c_str()); |
| 324 | if (sym == nullptr) { |
| 325 | static WCHAR szBuf[256]; |
| 326 | ::FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, ::GetLastError(), |
| 327 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), szBuf, sizeof(szBuf) / sizeof(WCHAR), nullptr); |
| 328 | throw cs::runtime_error(wstring_to_utf8(szBuf)); |
| 329 | } |
| 330 | return sym; |
| 331 | } |
| 332 | |
| 333 | void *find_symbol(void *handle, std::string_view symbol) |
| 334 | { |
no test coverage detected