Now that I have a working Mac OS X setup, added the initial groundwork for the OS X port. This C file works correctly on both amd64 and i386 with clang [-m32] runtimetest.c -lobjc -framework Foundation; it will be converted to Go now.
This commit is contained in:
parent
417ed1f727
commit
fa7ef40c42
|
@ -0,0 +1,22 @@
|
||||||
|
// 27 february 2014
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <objc/message.h>
|
||||||
|
#include <objc/objc.h>
|
||||||
|
#include <objc/runtime.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
id NSString = objc_getClass("NSString");
|
||||||
|
SEL stringFromUTF8String =
|
||||||
|
sel_getUid("stringWithUTF8String:");
|
||||||
|
id str = objc_msgSend(NSString,
|
||||||
|
stringFromUTF8String,
|
||||||
|
"hello, world\n");
|
||||||
|
SEL UTF8String =
|
||||||
|
sel_getUid("UTF8String");
|
||||||
|
|
||||||
|
printf("%s",
|
||||||
|
(char *) objc_msgSend(str,
|
||||||
|
UTF8String));
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue