Hello, I'm trying out the new interface to Objective-C and I
can't get this to compile:
module main;
extern (Objective-C) {
interface NSObject {
void release() @selector("release");
}
interface NSString : NSObject {
const(char)* UTF8String() @selector("UTF8String");
}
interface NSProcessInfo : NSObject {
static NSProcessInfo processInfo()
@selector("processInfo");
NSString operatingSystemVersionString()
@selector("operatingSystemVersionString");
}
}
void main() {
import std.stdio;
auto str =
NSProcessInfo.processInfo.operatingSystemVersionString;
writeln(str.UTF8String);
str.release();
}
I used the following command line:
dmd main.d -L-framework -LFoundation
I'm running the latest dmd (2.069.2) and it exits after printing
this message:
Assertion failed: (ethis), function
objc_callfunc_setupMethodCall, file objc_glue.c, line 276.
Abort trap: 6
This is from the class method call to NSProcessInfo.processInfo.
I've tried without the selector but get a linker error on
__D4main13NSProcessInfo11processInfoYZC4main13NSProcessInfo.
I'm not sure if it is a bug or if I'm not using it correctly so
I'm asking here before opening a bug report :)