#include "Win32.h"
#ifdef __MINGW32__
-#include <imagehlp.h>
+ #include <imagehlp.h>
#else
-#include <dbghelp.h>
+ #include <dbghelp.h>
#endif
-#pragma comment(lib, "dbghelp.lib")
+#ifdef __MINGW32__
+ #if (HAVE_LIBIMAGEHLP != 1)
+ #error "libimagehlp.a should be present"
+ #endif
+#else
+ #pragma comment(lib, "dbghelp.lib")
+#endif
namespace llvm {
using namespace sys;
}
}
-void DynamicLibrary::LoadLibraryPermanently(const char* filename) {
+bool DynamicLibrary::LoadLibraryPermanently(const char *filename,
+ std::string *ErrMsg) {
if (filename) {
HMODULE a_handle = LoadLibrary(filename);
if (a_handle == 0)
- ThrowError(std::string(filename) + ": Can't open : ");
+ return GetError(std::string(filename) + ": Can't open : ", ErrMsg);
OpenedHandles.push_back(a_handle);
} else {
// Because we don't remember the handle, we will never free it; hence,
// it is loaded permanently.
+ return false;
}
void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {