From a66ad7eb6322c62430bce3fece3ebd9068eb2dac Mon Sep 17 00:00:00 2001 From: mntone Date: Sun, 25 Jun 2017 21:13:43 +0900 Subject: [PATCH] libobs: Use RTLD_FIRST when loading libraries on macOS Ensures that functions loaded by `os_dlsym()` come only from the specified library that was loaded with `os_dlopen()` rather than the set of libraries loaded by the specified library. --- libobs/util/platform-nix.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libobs/util/platform-nix.c b/libobs/util/platform-nix.c index a3612b740..2fcdd437c 100644 --- a/libobs/util/platform-nix.c +++ b/libobs/util/platform-nix.c @@ -67,7 +67,11 @@ void *os_dlopen(const char *path) #endif dstr_cat(&dylib_name, ".so"); +#ifdef __APPLE__ + void *res = dlopen(dylib_name.array, RTLD_LAZY | RTLD_FIRST); +#else void *res = dlopen(dylib_name.array, RTLD_LAZY); +#endif if (!res) blog(LOG_ERROR, "os_dlopen(%s->%s): %s\n", path, dylib_name.array, dlerror());