Skip to content

Commit

Permalink
Add test only if Paths is included
Browse files Browse the repository at this point in the history
Signed-off-by: Shreyas Atre <[email protected]>
  • Loading branch information
SAtacker committed Jan 28, 2024
1 parent d107d24 commit be4ba59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Interpreter/Paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions unittests/CppInterOp/DynamicLibraryManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ TEST(DynamicLibraryManagerTest, Sanity) {
// EXPECT_FALSE(Cpp::GetFunctionAddress("ret_zero"));
}

#if defined(CPPINTEROP_UTILS_PATHS_H)
TEST(UtilsPlatform, DLTest) {
std::string err = "";
#ifdef __APPLE__
Expand All @@ -71,3 +72,4 @@ TEST(UtilsPlatform, DLTest) {
#endif
(void)dlopen_handle;
}
#endif

0 comments on commit be4ba59

Please sign in to comment.