18 #include "precompiled.h"
37 #ifdef INSTALLED_LIBDIR
45 static CStr
prefix =
"lib";
58 static CStr
suffixes[] = {
"",
"_dbg" };
87 if (!frameworksPath.empty())
88 n = frameworksPath +
"/";
99 n =
"@executable_path/";
128 errors <<
"dlopen(" << filename <<
") failed: " <<
dlerror() <<
"; ";
137 : m_Name(name), m_Handle(0)
160 std::stringstream errors;
164 LOGERROR(L
"DllLoader: %hs", errors.str().c_str());
185 debug_warn(L
"Loading symbol from invalid DLL");
bool osx_IsAppBundleValid()
Check if app is running in a valid bundle.
static void *const HANDLE_UNAVAILABLE
void Unload()
Unload the library, if it has been loaded already.
DllLoader(const char *name)
Prepare the DLL loader.
C++ interface to Cocoa implementation for getting bundle information.
static CStr GenerateFilename(const CStr &name, const CStr &suffix, const CStr &extension)
bool IsLoaded() const
Check whether the library has been loaded successfully.
void * dlopen(const char *so_name, int flags)
int dlclose(void *handle)
void * dlsym(void *handle, const char *sym_name)
#define TIMER(description)
Measures the time taken to execute code up until end of the current scope; displays it via debug_prin...
bool LoadDLL()
Attempt to load and initialise the library, if not already.
std::string osx_GetBundleFrameworksPath()
Get the system path to the bundle's Frameworks directory.
static void * LoadAnyVariant(const CStr &name, std::stringstream &errors)
static void OverrideLibdir(const char *libdir)
Override the build-time setting of the directory to search for libraries.
static Handle handle(size_t idx, u64 tag)
#define debug_warn(expr)
display the error dialog with the given text.
void LoadSymbolInternal(const char *name, void **fptr) const