#include "library.h"
#include "sysinfo.h"
#include "filename.h"
#if defined(__WIN32__)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
namespace embree
{
lib_t openLibrary(const std::string& file)
{
std::string fullName = file+".dll";
FileName executable = getExecutableFileName();
HANDLE handle = LoadLibrary((executable.path() + fullName).c_str());
return lib_t(handle);
}
void* getSymbol(lib_t lib, const std::string& sym) {
return (void*)GetProcAddress(HMODULE(lib),sym.c_str());
}
void closeLibrary(lib_t lib) {
FreeLibrary(HMODULE(lib));
}
}
#endif
#if defined(__UNIX__)
#include <dlfcn.h>
namespace embree
{
lib_t openLibrary(const std::string& file)
{ … }
void* getSymbol(lib_t lib, const std::string& sym) { … }
void closeLibrary(lib_t lib) { … }
}
#endif