D/Objective-C

Note: this project is based on a fairely old version of the DMD compiler and is no longer updated. See Jacob Carlborg’s updated version for something more up-to-date with support for 64 bit Cocoa.

Download

DMD/Objective-C Alpha 1 (3.26 Mb)
D/Objective-C compiler, June 1, 2011. Based on DMD 2.053.
Chocolate Alpha 1 (52 Kb)
Sample Cocoa project written in D/Objective-C, June 1, 2011. Requires D for Xcode.

You can track the development of this project from the Git repository at Github.

Introduction

This project is an extension of the D programming language adding support for Objective-C objects. DMD/Objective-C is a modified version of DMD, the reference compiler for D, which implements those additions. The ultimate goal is to merge the capabilities back into mainline DMD, which should be doable once it is proven solid and usable enough.

With D/Objective-C, D can interact directly with Objective-C objects almost exactly as if they were regular D objects. All we have to do is provide a declaration for the classes we want to use.

When interacting with Objective-C objects or creating new derived classes, the D compiler emits compiled code similar to what an Objective-C compiler would emit. There is generally no performance penalty when calling Objective-C code from D or when implementing Objective-C classes in D.

D/Objective-C is targeted solely at Apple’s Mac OS X Objective-C runtime at this time.

How to Use

The download above contains a folder with the same layout as the official DMD distribution, so you should be able to simply replace any installation of DMD with this one and keep things working. It lacks support for platforms other than Mac OS X as well as some of Digital Mars’s proprietary tools; if you need any of the later you can find them in the official DMD distribution.

If you have installed D for Xcode, you can simply replace the “dmd2” folder it installed at “/Library/Compilers” with the download above (rename it to “dmd2”) to use it from Xcode.

Still to do

History

DMD/Objective-C Alpha 1 (2011-06-01)

Prehistory

This project was preceded by another one which consisted of creating a bridge without any help from the compiler. The approach was later abandoned in favor of hacking the compiler.

License

DMD/Objective-C remains under the same license as DMD. The front end’s license is GPL/Artistic while the backend is under a proprietary license. Most of the runtime library and Phobos are under the Boost license. See the license file included with the distribution for details.

DMD/Objective-C is derived from DMD Copyright © 1999-2011 by Digital Mars written by Walter Bright. Distributed with permission.


  • © 2003–2024 Michel Fortin.