D/Objective-C Bridge still alive, now working on D2
Michel Fortin
michel.fortin at michelf.com
Thu Jun 24 11:37:29 PDT 2010
On 2010-06-24 07:36:28 -0400, Trass3r <un at known.com> said:
> How does it work?
http://michelf.com/weblog/2007/d-objc-bridge/
> Could something similar be created for C++ (automatically creating
> wrappers around C++ classes or whatever)?
Hardly. You could probably manage it somewhat with a custom C++
preprocessor and imposing a common base class, sort of how Qt is build
and probably more complex, but it wouldn't fit as well as it does with
D. That all D classes derives from Object is quite handy for the bridge
as it allows automatic mapping the Objective-C isEqual: method to
opEquals, hash to hash, and compare: to opCmp. This automatically makes
all D objects good citizens in Objective-C land, and vice-versa, even
though you have to manually write mappings for method names if you have
additional methods. D classes being always on the heap makes things
much smoother too.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d-announce
mailing list