16 #include "executionEnvironment.h" 38 #define WINDOWS_LEAN_AND_MEAN 40 #undef WINDOWS_LEAN_AND_MEAN 49 Filename abspath = resolve_dso(path, filename);
56 typedef HMODULE (WINAPI *tLoadLibraryEx)(LPCTSTR, HANDLE, DWORD);
57 tLoadLibraryEx pLoadLibraryEx;
58 HINSTANCE hLib = LoadLibrary(
"kernel32.dll");
60 pLoadLibraryEx = (tLoadLibraryEx)GetProcAddress(hLib,
"LoadLibraryExA");
62 return pLoadLibraryEx(os_specific.c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
66 return LoadLibrary(os_specific.c_str());
70 unload_dso(
void *dso_handle) {
71 HMODULE dll_handle = (HMODULE) dso_handle;
74 return (FreeLibrary(dll_handle)!=0);
79 DWORD last_error = GetLastError();
97 case 2:
return "File not found";
98 case 3:
return "Path not found";
99 case 4:
return "Too many open files";
100 case 5:
return "Access denied";
101 case 14:
return "Out of memory";
102 case 18:
return "No more files";
103 case 126:
return "Module not found";
104 case 127:
return "The specified procedure could not be found";
105 case 193:
return "Not a valid Win32 application";
106 case 998:
return "Invalid access to memory location";
111 errmsg <<
"Unknown error " << last_error;
116 get_dso_symbol(
void *handle,
const string &name) {
118 return (
void *)GetProcAddress((HMODULE)handle, name.c_str());
127 #include <mach-o/dyld.h> 134 Filename abspath = resolve_dso(path, filename);
139 return dlopen(os_specific.c_str(), RTLD_NOW | RTLD_GLOBAL);
143 unload_dso(
void *dso_handle) {
144 return dlclose(dso_handle)==0;
149 const char *message = dlerror();
150 if (message != (
const char *)NULL) {
151 return std::string(message);
157 get_dso_symbol(
void *handle,
const string &name) {
158 return dlsym(handle, name.c_str());
string get_dirname() const
Returns the directory part of the filename.
int get_num_directories() const
Returns the number of directories on the search list.
const Filename & get_directory(int n) const
Returns the nth directory on the search list.
The name of a file, such as a texture file or an Egg file.
static string get_dtool_name()
Returns the name of the libdtool DLL that is used in this program, if it can be determined.
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.
This class stores a list of directories that can be searched, in order, to locate a particular file...
string to_os_specific() const
Converts the filename from our generic Unix-like convention (forward slashes starting with the root a...
Filename find_file(const Filename &filename) const
Searches all the directories in the search list for the indicated file, in order. ...