Created
October 24, 2018 15:02
-
-
Save iffy/1cd472da9b2135ccc2a1cc1da3f83bbc to your computer and use it in GitHub Desktop.
What I changed on https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importobjc-pragma to get it to work on my mac
This file contains 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
--- /tmp/orig.nim 2018-10-24 09:01:22.000000000 -0600 | |
+++ /tmp/frommanual.nim 2018-10-24 09:00:51.000000000 -0600 | |
@@ -1,7 +1,6 @@ | |
-{.passL: "-lobjc".} | |
{.emit: """ | |
-#include <objc/Object.h> | |
-@interface Greeter:Object | |
+#include <Cocoa/Cocoa.h> | |
+@interface Greeter:NSObject | |
{ | |
} | |
@@ -21,12 +20,10 @@ | |
""".} | |
type | |
- Id {.importc: "id", header: "<objc/Object.h>", final.} = distinct int | |
+ Id {.importc: "id", header: "<Cocoa/Cocoa.h>", final.} = distinct int | |
proc newGreeter: Id {.importobjc: "Greeter new", nodecl.} | |
proc greet(self: Id, x, y: int) {.importobjc: "greet", nodecl.} | |
-proc free(self: Id) {.importobjc: "free", nodecl.} | |
var g = newGreeter() | |
g.greet(12, 34) | |
-g.free() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment