www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - D/Objective-C Bridge still alive, now working on D2

reply Michel Fortin <michel.fortin michelf.com> writes:
Some of you already know my D/Objective-C bridge[1]. I know it has been 
a while since it was last updated, and it was limited to D1, and was 
left not working on Snow Leopard. Well, this morning I pushed a working 
D2 version on the Git repository mirror[2]. This is not an official 
release, it still lacks a lot of polish and some parts are in flux, but 
perhaps some of you will be interested in trying it out from the 
repository.

[1]: http://michelf.com/projects/d-objc-bridge/
[2]: http://git.michelf.com/d-objc/

That said, I can't make it compile with the -inline switch. Seems like 
all those instantiated templates and mixins are too much for the 
compiler to handle... some files take forever to compile (literally). I 
guess I should try to reduce the template bloat, which should also 
reduce the insanely big output files.

-- 
Michel Fortin
michel.fortin michelf.com
http://michelf.com/
Jun 23 2010
parent reply Trass3r <un known.com> writes:
How does it work? Could something similar be created for C++  
(automatically creating wrappers around C++ classes or whatever)?
Jun 24 2010
parent Michel Fortin <michel.fortin michelf.com> writes:
On 2010-06-24 07:36:28 -0400, Trass3r <un 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 michelf.com http://michelf.com/
Jun 24 2010