On Thursday, 29 March 2012 at 12:10:17 UTC, Jacob Carlborg wrote:
I have some with using Objective-C together with D. It's a lot
more verbose and quite more complicated than using a C library
with D.
How complicated it is depends on what one want to do with the
Objective-C library. Obviously one want to create Objective-C
objects and call Objective-C methods. But if it's necessary to
create subclasses in D and have Objective-C create instances of
those classes and call methods on the objects it gets even more
complicated.
I would recommend to have a look at Michel Fortin's fork of DMD
which adds support for binding to Objective-C code directly,
i.e. extern(Objective-C). Note that it's not 100% complete and
based on an older version of DMD.
http://michelf.com/projects/d-objc/
Thanks for the link. Objective-C is basically C and can be
implemented in C style as far as I know. Is it worth going down
to the C level like so:
struct NSObject {
struct objc_class* isa;
}
struct objc_class {
Class isa;
Class super_class;
const char *name;
long version;
long info;
long instance_size;
struct objc_ivar_list *ivars;
struct objc_method_list **methodLists;
struct objc_cache *cache;
struct objc_protocol_list *protocols;
}
Just a random thought.