MCPcopy Create free account
hub / github.com/covscript/covscript / open

Function open

sources/system/win32/common.cpp:320–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

can_executeFunction · 0.70

Calls 3

utf8_to_wstringFunction · 0.85
runtime_errorClass · 0.85
wstring_to_utf8Function · 0.85

Tested by

no test coverage detected