Skip to content

Commit b132692

Browse files
Try using .dylib suffix on macs.
1 parent e0eab70 commit b132692

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

source/non_limited_api/non_limited_api_stubs.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@
66
#define PYBIND11_NONLIMITEDAPI_DLOPEN(dir, file) LoadLibraryW((dir + std::wstring(file.begin(), file.end()) + L".dll").c_str())
77
#define PYBIND11_NONLIMITEDAPI_DLOPEN_ERROR std::to_string(GetLastError()).c_str()
88
#else
9+
#ifdef __APPLE__
10+
#define PYBIND11_NONLIMITEDAPI_SHLIB_SUFFIX ".dylib"
11+
#else
12+
#define PYBIND11_NONLIMITEDAPI_SHLIB_SUFFIX ".so"
13+
#endif
914
#include <dlfcn.h> // For `dlopen` and friends.
10-
#define PYBIND11_NONLIMITEDAPI_DLOPEN(dir, file) dlopen((dir + "lib" + file + ".so").c_str(), RTLD_NOW | RTLD_GLOBAL)
15+
#define PYBIND11_NONLIMITEDAPI_DLOPEN(dir, file) dlopen((dir + "lib" + file + PYBIND11_NONLIMITEDAPI_SHLIB_SUFFIX).c_str(), RTLD_NOW | RTLD_GLOBAL)
1116
#define PYBIND11_NONLIMITEDAPI_DLOPEN_ERROR dlerror()
1217
#endif
1318

0 commit comments

Comments
 (0)