summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-27 20:07:56 -0500
committerPietro Gagliardi <[email protected]>2014-02-27 20:07:56 -0500
commitfa7ef40c42c30807395ab3fe5019e04928102a20 (patch)
tree7e489dcb2cdcbbcc1346aeb4251c40e35953d429
parent417ed1f72778721a0122932612bbeeba22c20d1e (diff)
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.
-rw-r--r--darwintest/runtimetest.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/darwintest/runtimetest.c b/darwintest/runtimetest.c
new file mode 100644
index 0000000..c0109d3
--- /dev/null
+++ b/darwintest/runtimetest.c
@@ -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;
+}