diff --git a/include/thorin/util/dl.h b/include/thorin/util/dl.h index e963fa8cff..d466e50008 100644 --- a/include/thorin/util/dl.h +++ b/include/thorin/util/dl.h @@ -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); diff --git a/src/thorin/driver.cpp b/src/thorin/driver.cpp index ba0bf6771b..d0d1d65a18 100644 --- a/src/thorin/driver.cpp +++ b/src/thorin/driver.cpp @@ -11,7 +11,7 @@ namespace { std::vector get_plugin_name_variants(std::string_view name) { std::vector 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 diff --git a/src/thorin/util/dl.cpp b/src/thorin/util/dl.cpp index 05958c0ff0..aaecd84968 100644 --- a/src/thorin/util/dl.cpp +++ b/src/thorin/util/dl.cpp @@ -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)) {