X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FPluginLoader.cpp;h=39e3c0afa538216fa139ac0525497823f437cc87;hb=ef9531efedd2233269f670227fb0e6aae7480d53;hp=2c13d57812994d32957ec2f241a591dd6aa04686;hpb=551ccae044b0ff658fe629dd67edd5ffe75d10e8;p=oota-llvm.git diff --git a/lib/Support/PluginLoader.cpp b/lib/Support/PluginLoader.cpp index 2c13d578129..39e3c0afa53 100644 --- a/lib/Support/PluginLoader.cpp +++ b/lib/Support/PluginLoader.cpp @@ -13,13 +13,23 @@ #define DONT_GET_PLUGIN_LOADER_OPTION #include "llvm/Support/PluginLoader.h" -#include "llvm/Support/DynamicLinker.h" +#include "llvm/System/DynamicLibrary.h" #include + using namespace llvm; void PluginLoader::operator=(const std::string &Filename) { std::string ErrorMessage; - if (LinkDynamicObject(Filename.c_str(), &ErrorMessage)) + try { + sys::DynamicLibrary::LoadLibraryPermanently(Filename.c_str()); + } catch (const std::string& errmsg) { + if (errmsg.empty()) { + ErrorMessage = "Unknown"; + } else { + ErrorMessage = errmsg; + } + } + if (!ErrorMessage.empty()) std::cerr << "Error opening '" << Filename << "': " << ErrorMessage << "\n -load request ignored.\n"; }