File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,25 @@ mod tests {
206206 use objc:: runtime:: Object ;
207207 use objc:: { class, msg_send} ;
208208
209+ #[ cfg( not( target_vendor = "apple" ) ) ]
210+ use objc:: runtime:: Class ;
211+
212+ #[ cfg( not( target_vendor = "apple" ) ) ]
213+ #[ link( name = "gnustep-base" , kind = "dylib" ) ]
214+ extern "C" { }
215+
216+ // TODO: Remove the need for this hack
217+ #[ cfg( not( target_vendor = "apple" ) ) ]
218+ extern "C" {
219+ static _OBJC_CLASS_NSObject: Class ;
220+ }
221+
222+ #[ cfg( not( target_vendor = "apple" ) ) ]
223+ #[ test]
224+ fn get_class_to_force_linkage ( ) {
225+ unsafe { & _OBJC_CLASS_NSObject } ;
226+ }
227+
209228 fn retain_count ( obj : & Object ) -> usize {
210229 unsafe { msg_send ! [ obj, retainCount] }
211230 }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ which can be cloned to allow multiple references.
1111
1212Weak references may be created using the [`WeakId`](struct.WeakId.html) struct.
1313
14- ```
14+ ```no_run
1515# use objc::msg_send;
1616use objc::runtime::{Class, Object};
1717use objc_id::{Id, WeakId};
You can’t perform that action at this time.
0 commit comments