Skip to content

Instantly share code, notes, and snippets.

@iffy
Created October 24, 2018 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iffy/1cd472da9b2135ccc2a1cc1da3f83bbc to your computer and use it in GitHub Desktop.
Save iffy/1cd472da9b2135ccc2a1cc1da3f83bbc to your computer and use it in GitHub Desktop.
--- /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