diff --git a/lib/Interpreter/Paths.cpp b/lib/Interpreter/Paths.cpp index e0e2762f..367592a0 100644 --- a/lib/Interpreter/Paths.cpp +++ b/lib/Interpreter/Paths.cpp @@ -108,15 +108,15 @@ namespace platform { #if defined(_WIN32) void* DLOpen(const std::string& Path, std::string& Err /* = nullptr */) { - auto lib = llvm::sys::DynamicLibrary::getLibrary(Path.c_str(), Err); + auto lib = llvm::sys::DynamicLibrary::getLibrary(Path.c_str(), &Err); return lib.getOSSpecificHandle(); } void DLClose(void* Lib, std::string& Err /* = nullptr*/) { auto dl = llvm::sys::DynamicLibrary(Lib); llvm::sys::DynamicLibrary::closeLibrary(dl); - if (Err) { - *Err = std::string(); + if (Err.empty()) { + Err = std::string(); } } #else diff --git a/unittests/CppInterOp/DynamicLibraryManagerTest.cpp b/unittests/CppInterOp/DynamicLibraryManagerTest.cpp index cf48e052..5050b908 100644 --- a/unittests/CppInterOp/DynamicLibraryManagerTest.cpp +++ b/unittests/CppInterOp/DynamicLibraryManagerTest.cpp @@ -59,10 +59,10 @@ TEST(DynamicLibraryManagerTest, Sanity) { TEST(UtilsPlatform, DLTest) { std::string err = ""; -#ifdef __APPLE__ +#if defined(__APPLE__) auto dlopen_handle = Cpp::utils::platform::DLOpen( "./unittests/CppInterOp/libTestSharedLib.dylib", err); -#elif defined(__WIN32__) +#elif defined(_WIN32) auto dlopen_handle = Cpp::utils::platform::DLOpen( "./unittests/CppInterOp/libTestSharedLib.dll", err); #else