Skip to content

Commit 482e6ee

Browse files
authored
Add RTLD_DEEPBIND flag to dlopen mode (#2247)
1 parent e28ca6b commit 482e6ee

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

binding/Binding.Shared/LibraryLoader.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,17 @@ private static class Linux
202202

203203
private const int RTLD_LAZY = 1;
204204
private const int RTLD_NOW = 2;
205+
private const int RTLD_DEEPBIND = 8;
205206

206207
private static bool UseSystemLibrary2 = true;
207208

208209
public static IntPtr dlopen (string path, bool lazy = true)
209210
{
210211
try {
211-
return dlopen2 (path, lazy ? RTLD_LAZY : RTLD_NOW);
212+
return dlopen2 (path, (lazy ? RTLD_LAZY : RTLD_NOW) | RTLD_DEEPBIND);
212213
} catch (DllNotFoundException) {
213214
UseSystemLibrary2 = false;
214-
return dlopen1 (path, lazy ? RTLD_LAZY : RTLD_NOW);
215+
return dlopen1 (path, (lazy ? RTLD_LAZY : RTLD_NOW) | RTLD_DEEPBIND);
215216
}
216217
}
217218

0 commit comments

Comments
 (0)