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());
std::string get_dirname() const
Returns the directory part of the filename.
get_dtool_name
Returns the name of the libdtool DLL that is used in this program, if it can be determined.
std::wstring to_os_specific_w() const
The wide-string variant on to_os_specific().
get_num_directories
Returns the number of directories on the search list.
The name of a file, such as a texture file or an Egg file.
bool is_local() const
Returns true if the filename is local, e.g.
bool is_regular_file() const
Returns true if the filename exists and is the name of a regular file (i.e.
get_directory
Returns the nth directory on the search list.
This class stores a list of directories that can be searched, in order, to locate a particular file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::string to_os_specific() const
Converts the filename from our generic Unix-like convention (forward slashes starting with the root a...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Filename find_file(const Filename &filename) const
Searches all the directories in the search list for the indicated file, in order.