DerelictCocoa

Jacob Carlborg via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Jul 31 12:10:04 PDT 2015


On 31/07/15 01:21, ponce wrote:

> Unfortunately I'm stuck because OS X shared libraries are not
> implemented in DMD so it may be quite a long time before I can use a
> 2.068 front-end for all this. My target is the currently available
> 2.066/2.067.

I see, you're using LDC? Then I recommend you have a look at the 
Objective-C bridge [1] I created. It has not been updated in a very long 
time but I think you can use it as a base. Perhaps just update it for D2.

> Actually I've skimmed it before and failed to understand if it allows to
> subclass ObjC objects. If it doesn't then calling the runtime might
> still be necessary.

The implementation that is currently in DMD head is a very limited 
implementation that only supports calling instance methods. So no, 
currently it's not possible to subclass Objective-C classes.

> Not really a problem since class functions do not seem tricky like
> objc_msgSend_*.

Class methods work the same as instance methods. In Objective-C classes 
are objects themselves.

> I was also unsure if extern(Objective-C) helps with the runtime
> functions themselves, or rather only dispatch to the right runtime
> function obj_msgSend_*. Or both.

It will call a method in the same way as the Objective-C compiler would 
do. That means calling obj_msgSend_*.

[1] http://dsource.org/projects/dstep

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list