Incorporating D

Jacob Carlborg doob at me.com
Sat Jan 26 05:14:48 PST 2013


On 2013-01-25 21:45, Szymon wrote:

> 3) Is it possible to use D on iOS?

The short answer is, no. The longer more detailed answer is, DMD cannot 
output ARM code. That means you need to use LDC or GDC. Don't know how 
good they work, also I don't know the status of the runtime on ARM. Then 
you need to somehow integrate the D compiler in the iOS tool chain.

Except from actually be able to compile for iOS you need some way to 
integrate with Objective-C, if you want to do anything useful. For that 
you have three options:

1. The Objective-C runtime functions are implemented in standard C which 
D can call and link to. It becomes very tedious very fast using this 
approach.

2. Use the Objective-C runtime functions via a bridge that handles all 
type conversions and similar automatically. This causes code bloat due 
to template and virtual methods that cannot be optimized away. On Mac OS 
X we're talking about 60MB for a Hello World application.

3. Make D ABI compatible with Objective-C, i.e. extern (Objective-C). 
Michel Fortin has created a fork of DMD that implements this. He has 
released an alpha version of this fork which do work. Unfortunately the 
code hasn't been update for two to three years.

The most correct approach would be number three.

Objective-C bridge: http://www.dsource.org/projects/dstep
D with support for Objective-C: http://michelf.ca/projects/d-objc/

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list