Skip to content

Instantly share code, notes, and snippets.

@philip-wernersbach
Created February 16, 2015 22:44
Show Gist options
  • Save philip-wernersbach/e987bb6e1454fccb1b0a to your computer and use it in GitHub Desktop.
Save philip-wernersbach/e987bb6e1454fccb1b0a to your computer and use it in GitHub Desktop.
Araq/Nim: Basic Objective-C FFI fails to compile on OS X
# For simplicity, doesn't use anything from Foundation, like NSObject or NSString.
# Just basic Objective-C FFI.
{.emit: """
@interface Foo
+ (void)bar;
@end
@implementation Foo
+ (void)bar {}
@end
""".}
proc fooBar {.importobjc: "Foo bar", nodecl.}
fooBar()
$ nim objc --parallelBuild:1 --noNimblePath -r nim_objc_osx_error
Hint: used config file '/Users/philip/Nim/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: nim_objc_osx_error [Processing]
clang -c -w -I/Users/philip/Nim/lib -o nimcache/nim_objc_osx_error.o nimcache/nim_objc_osx_error.m
[Linking]
Undefined symbols for architecture x86_64:
"__objc_empty_cache", referenced from:
_OBJC_CLASS_$_Foo in nim_objc_osx_error.o
_OBJC_METACLASS_$_Foo in nim_objc_osx_error.o
"_objc_msgSend", referenced from:
_nim_objc_osx_errorInit in nim_objc_osx_error.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of an external program failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment