Skip to content

Commit

Permalink
removing dl::extension
Browse files Browse the repository at this point in the history
Replace with extensions array as at least with macos we need to check
for .so and .dylib
  • Loading branch information
leissa committed Dec 21, 2023
1 parent e2495a3 commit 04e452c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/thorin/util/dl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace thorin::dl {

std::string_view extension(); ///< `".dll"` or `".so"`
static constexpr auto extensions = {"dll", "dylib", "so"};

void* open(const char* filename);
void* get(void* handle, const char* symbol_name);
Expand Down
2 changes: 1 addition & 1 deletion src/thorin/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace {
std::vector<fs::path> get_plugin_name_variants(std::string_view name) {
std::vector<fs::path> names;
names.push_back(name); // if the user gives "libthorin_foo.so"
names.push_back(fmt("libthorin_{}{}", name, dl::extension()));
for (auto ext : dl::extensions) names.push_back(fmt("libthorin_{}.{}", name, ext));
return names;
}
} // namespace
Expand Down
8 changes: 0 additions & 8 deletions src/thorin/util/dl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@

namespace thorin::dl {

std::string_view extension() {
#ifdef _WIN32
return ".dll";
#else
return ".so";
#endif
}

void* open(const char* file) {
#ifdef _WIN32
if (HMODULE handle = LoadLibraryA(file)) {
Expand Down

0 comments on commit 04e452c

Please sign in to comment.