Skip to content

Commit

Permalink
Fix extension
Browse files Browse the repository at this point in the history
  • Loading branch information
erick-xanadu committed Apr 9, 2024
1 parent 387af82 commit d771b61
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion runtime/lib/registry/Registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,32 @@ class LibraryManager {
}
};

inline const uintptr_t ext_macos()
{
#ifdef __APPLE__
return reinterpret_cast<uintptr_t>(".dylib");
#else
return reinterpret_cast<uintptr_t>(nullptr);
#endif
}

inline const uintptr_t ext_unix()
{
#ifdef __linux__
return reinterpret_cast<uintptr_t>(".so");
#else
return reinterpret_cast<uintptr_t>(nullptr);
#endif
}

inline const char *ext()
{
const uintptr_t ext_target = ext_macos() | ext_unix();
return reinterpret_cast<char *>(ext_target);
}

std::string library_name(std::string name) { return name + ext(); }

void convertResult(py::handle tuple)
{
py::object unrankedMemrefPtrSizeTuple = tuple.attr("__getitem__")(0);
Expand All @@ -91,7 +117,7 @@ void convertResult(py::handle tuple)
UnrankedMemrefType *src = (UnrankedMemrefType *)unranked_memref_ptr;
UnrankedMemrefType destMemref = {src->rank, destAsPtr};

std::string libpath = libmlirpath + "/libmlir_c_runner_utils.so";
std::string libpath = libmlirpath + library_name("/libmlir_c_runner_utils");
LibraryManager memrefCopy(libpath);
memrefCopy(e_size, src, &destMemref);
}
Expand Down

0 comments on commit d771b61

Please sign in to comment.