GUI program on Mac OS in D?
Jacob Carlborg
doob at me.com
Thu Dec 14 10:14:13 UTC 2017
On 2017-12-13 16:59, mrphobby wrote:
> I have another question about your Webkit test example... I see that you
> are doing some elaborate setup in order to bind the application delegate
> methods. Can you explain a bit about why you are doing it in this way
> instead of using the @selector attribute in a class?
That is to register the methods with the Objective-C runtime. Currently
the @selector attribute can only be used on methods that are already
implemented in Objective-C. If a need to implement a new method or
override an existing method in a subclass, then it's necessary to
manually register that method with the runtime.
This is because the full implementation of DIP43 [1] is not done/merged yet.
But trust me, this is a lot simpler than without any compiler support at
all. Then you would need to know details of the ABI to call Objective-C
methods.
The methods I've added in the WebKit example are methods that will only
be called as callbacks by the Objective-C code. If I want to call them
myself I would need the @selector attribute as well, in addition to the
manual registering.
> The thing is that I'm currently attempting to get it to work using the
> "easy" way using @selector but the methods in my AppDelegate class are
> not called. Not sure why that is, but I probably screwed something up :)
Yes, see above.
[1] https://wiki.dlang.org/DIP43
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list