Skip to content

Commit 1d4b866

Browse files
committed
comments describing why objc::class!() and objc::selector!() only expose the static value
1 parent a9521e4 commit 1d4b866

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

library/core/src/os/darwin/objc.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ pub type SEL = *mut objc_selector;
7272
/// ```
7373
#[allow_internal_unstable(rustc_attrs)]
7474
pub macro class($classname:expr) {{
75+
// Since static Objective-C class references actually end up with multiple definitions
76+
// across dylib boundaries, we only expose the value of the static and don't provide a way to
77+
// get the address of or a reference to the static.
7578
unsafe extern "C" {
7679
#[rustc_objc_class = $classname]
7780
safe static VAL: $crate::os::darwin::objc::Class;
@@ -93,6 +96,9 @@ pub macro class($classname:expr) {{
9396
/// ```
9497
#[allow_internal_unstable(rustc_attrs)]
9598
pub macro selector($methname:expr) {{
99+
// Since static Objective-C selector references actually end up with multiple definitions
100+
// across dylib boundaries, we only expose the value of the static and don't provide a way to
101+
// get the address of or a reference to the static.
96102
unsafe extern "C" {
97103
#[rustc_objc_selector = $methname]
98104
safe static VAL: $crate::os::darwin::objc::SEL;

0 commit comments

Comments
 (0)