[Issue 15444] [Interfacing to Objective-C]
https://issues.dlang.org/show_bug.cgi?id=15444 Maximochanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #2 from Maximo --- Here's the fix. It has to do with El Capitan and brew. I found the fix: $ sudo brew update $ sudo brew uninstall --force dmd $ sudo su $ cd /Library $ rm -rfd D $ exit $ sudo brew install dmd This not only takes one from an older dmd to a more current version (in my case, from 2.068 to 2.069), but it also fixes a bug where /Library/D doesn't get updated. (Besides, the El Capitan version of 2.069 now doesn't use /Library/D.) When I did that, I found I was able to compile like so: volomike:cpptod4 mike$ dmd -m64 -L-framework -LFoundation test.d volomike:cpptod4 mike$ ls testtest.dtest.o volomike:cpptod4 mike$ ./test 2015-12-15 03:07:52.669 test[7308:116958] Hello World! volomike:cpptod4 mike$ So, it not only used an Objective C NSString object, but it fed it to NSLog and I got console output in NSLog format. --
[Issue 15444] [Interfacing to Objective-C]
https://issues.dlang.org/show_bug.cgi?id=15444 Jacob Carlborgchanged: What|Removed |Added CC||d...@me.com Severity|major |minor --- Comment #1 from Jacob Carlborg --- I added the code below for reference. It works perfectly fine for me using Yosemite. It's most likely an issue with the installation of the compiler. // test.d module main; extern (Objective-C) interface Class { NSString alloc() @selector("alloc"); } extern (Objective-C) interface NSString { NSString initWithUTF8String(in char* str) @selector("initWithUTF8String:"); void release() @selector("release"); } extern (C) void NSLog(NSString, ...); extern (C) Class objc_lookUpClass(in char* name); void main() { auto cls = objc_lookUpClass("NSString"); auto str = cls.alloc().initWithUTF8String("Hello World!"); NSLog(str); str.release(); } --
[Issue 15444] [Interfacing to Objective-C]
https://issues.dlang.org/show_bug.cgi?id=15444 ag0ae...@gmail.com changed: What|Removed |Added CC||ag0ae...@gmail.com Resolution|FIXED |WORKSFORME --- Comment #3 from ag0ae...@gmail.com --- Changing from FIXED to WORKSFORME since this was apparently an installation problem. --