X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSystem%2FDynamicLibrary.cpp;h=3bf172c22b3f376302cc30365fcc088f5a8376fb;hb=002ec1482c83003c6aef841395271aa5993d916a;hp=5e3b6cb56511aea80d05974569318f3f6245c9ff;hpb=ae55e04d7a89af2a02041ecbf7f46cba753fa8ce;p=oota-llvm.git diff --git a/lib/System/DynamicLibrary.cpp b/lib/System/DynamicLibrary.cpp index 5e3b6cb5651..3bf172c22b3 100644 --- a/lib/System/DynamicLibrary.cpp +++ b/lib/System/DynamicLibrary.cpp @@ -13,15 +13,19 @@ #include "llvm/System/DynamicLibrary.h" #include "llvm/Config/config.h" +#include #include #include // Collection of symbol name/value pairs to be searched prior to any libraries. -static std::map g_symbols; +std::map &g_symbols() { + static std::map symbols; + return symbols; +} void llvm::sys::DynamicLibrary::AddSymbol(const char* symbolName, void *symbolValue) { - g_symbols[symbolName] = symbolValue; + g_symbols()[symbolName] = symbolValue; } // It is not possible to use ltdl.c on VC++ builds as the terms of its LGPL @@ -75,8 +79,8 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { // check_ltdl_initialization(); // First check symbols added via AddSymbol(). - std::map::iterator I = g_symbols.find(symbolName); - if (I != g_symbols.end()) + std::map::iterator I = g_symbols().find(symbolName); + if (I != g_symbols().end()) return I->second; // Now search the libraries.