[Issue 15444] [Interfacing to Objective-C]
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Dec 15 00:04:22 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15444
Jacob Carlborg <doob at me.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |doob at me.com
Severity|major |minor
--- Comment #1 from Jacob Carlborg <doob at me.com> ---
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();
}
--
More information about the Digitalmars-d-bugs
mailing list