D/Objective-C 64bit
Michel Fortin via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Tue Nov 4 14:45:44 PST 2014
On 2014-11-04 09:07:08 +0000, "Christian Schneider"
<schneider at gerzonic.net> said:
> Ok, some more info:
>
> I changed the mapping in tableview.d to:
>
> void setDoubleAction(void __selector(ObjcObject))
> [setDoubleAction:] ;
That's indeed the best way to do it.
> This should be the way to do it. Now in the implementation of the
> action:
>
> void doubleClickAction(ObjcObject sender) {
> NSLog("double click action") ;
> NSLog("the sender: %@", sender) ;
> }
>
> This works fine and prints the log: 2014-11-04 10:01:57.967
> tableview[9988:507] the sender: <NSTableView: 0x7f8309f156b0>
>
> But now I would like to do something with this sender, like I do
> often in an Objective-C project:
>
> NSTableView tableView = cast(NSTableView)sender ;
>
> I get a EXC_BAD_ACCESS (SIGSEGV) on this line. Only when I
> replace both ObjcObject with NSObject (in tableview.d, the
> mapping, and the target action) this cast works. I might be
> missing something obvious here.
There is no test for interface-to-class casts in the D/Objective-C test
suite, which means you're likely the first person to try that. It's
probably just an oversight in the compiler code.
--
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca
More information about the Digitalmars-d-announce
mailing list