From 837159cdd1477a2e2dcd712878a435c06459cbe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Mon, 21 Aug 2023 11:00:40 +0900 Subject: [PATCH 1/2] add RTLD_MAIN_ONLY Apple's dynamic linker has this special handle called `RTLD_MAIN_ONLY` which you can feed to `dlsym(3)`. Their `dlfcn.h` says it has been around since Mac OS X 10.5. --- src/unix/bsd/apple/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 1602357366ee1..867a2814a2425 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -4189,6 +4189,7 @@ pub const RTLD_FIRST: ::c_int = 0x100; pub const RTLD_NODELETE: ::c_int = 0x80; pub const RTLD_NOLOAD: ::c_int = 0x10; pub const RTLD_GLOBAL: ::c_int = 0x8; +pub const RTLD_MAIN_ONLY: *mut ::c_void = -5isize as *mut c_void; pub const _WSTOPPED: ::c_int = 0o177; From ff6a0c677bce23b632fe5f1c22d07b9d0028972f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Mon, 21 Aug 2023 11:31:33 +0900 Subject: [PATCH 2/2] properly modify the type with :: --- src/unix/bsd/apple/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 867a2814a2425..a2fbf876731ba 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -4189,7 +4189,7 @@ pub const RTLD_FIRST: ::c_int = 0x100; pub const RTLD_NODELETE: ::c_int = 0x80; pub const RTLD_NOLOAD: ::c_int = 0x10; pub const RTLD_GLOBAL: ::c_int = 0x8; -pub const RTLD_MAIN_ONLY: *mut ::c_void = -5isize as *mut c_void; +pub const RTLD_MAIN_ONLY: *mut ::c_void = -5isize as *mut ::c_void; pub const _WSTOPPED: ::c_int = 0o177;