26 return spath.find_file(filename);
38 #define WINDOWS_LEAN_AND_MEAN
40 #undef WINDOWS_LEAN_AND_MEAN
48 Filename abspath = resolve_dso(path, filename);
55 typedef HMODULE (WINAPI *tLoadLibraryEx)(LPCWSTR, HANDLE, DWORD);
56 tLoadLibraryEx pLoadLibraryEx;
57 HINSTANCE hLib = LoadLibrary(
"kernel32.dll");
59 pLoadLibraryEx = (tLoadLibraryEx)GetProcAddress(hLib,
"LoadLibraryExW");
61 return pLoadLibraryEx(os_specific_w.c_str(),
nullptr, LOAD_WITH_ALTERED_SEARCH_PATH);
65 return LoadLibraryW(os_specific_w.c_str());
69 unload_dso(
void *dso_handle) {
70 HMODULE dll_handle = (HMODULE) dso_handle;
73 return (FreeLibrary(dll_handle)!=0);
78 DWORD last_error = GetLastError();
96 case 2:
return "File not found";
97 case 3:
return "Path not found";
98 case 4:
return "Too many open files";
99 case 5:
return "Access denied";
100 case 14:
return "Out of memory";
101 case 18:
return "No more files";
102 case 126:
return "Module not found";
103 case 127:
return "The specified procedure could not be found";
104 case 193:
return "Not a valid Win32 application";
105 case 998:
return "Invalid access to memory location";
109 std::ostringstream errmsg;
110 errmsg <<
"Unknown error " << last_error;
115 get_dso_symbol(
void *handle,
const string &name) {
117 return (
void *)GetProcAddress((HMODULE)handle, name.c_str());
126 #include <mach-o/dyld.h>
133 Filename abspath = resolve_dso(path, filename);
141 return dlopen(os_specific.c_str(), RTLD_NOW | RTLD_GLOBAL);
145 unload_dso(
void *dso_handle) {
146 return dlclose(dso_handle)==0;
151 const char *message = dlerror();
152 if (message !=
nullptr) {
153 return std::string(message);
159 get_dso_symbol(
void *handle,
const string &name) {
160 return dlsym(handle, name.c_str());