Created
April 29, 2014 09:06
-
-
Save fjolnir/11394712 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate libc; | |
use libc::uintptr_t; | |
type Sel = libc::uintptr_t; | |
enum ObjcObject {} | |
type Class<'a> = &'a ObjcObject; | |
type Id<'a> = &'a ObjcObject; | |
type NSObjectClass<'a> = Class<'a>; | |
type NSObject<'a> = Id<'a>; | |
type NSStringClass<'a> = NSObjectClass<'a>; | |
type NSString<'a> = NSObject<'a>; | |
#[link(name = "Foundation", kind = "framework")] | |
extern "C" { | |
fn sel_registerName(sel: *libc::c_char) -> Sel; | |
fn objc_msgSend(object: Id, sel: Sel, ...) -> Id; | |
#[link_name="OBJC_CLASS_$_NSString"] | |
static NSStringKlass:ObjcObject; | |
} | |
static NSString:NSStringClass<'static> = &NSStringKlass; // Crashes rustc | |
fn main() { unsafe { | |
// let NSString:NSStringClass = &NSStringKlass; // This works fine | |
} |
Author
fjolnir
commented
Apr 29, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment