iOS progress

Jacob Carlborg via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Tue Feb 17 23:44:36 PST 2015


On 2015-02-17 21:53, Laeeth Isharc wrote:

> This is great news.  I realize the magnitude of the
> accomplishment just in getting this to work, but if/when you have
> time would love to get a sense for what can and can't be done as
> far as accessing the iOS SDK/Cocoa given that the Objective C
> support is not yet complete.
>
> https://michelf.ca/projects/d-objc/

It's possible to access the complete Objective-C language from its 
runtime, which has a C API, meaning it can be accessed from D. It's 
quite cumbersome and verbose to use but can be used as a start to test.

The better alternative is, as you wrote above, implement language 
support for linking with Objective-C. The latest code and pull request 
for DMD is available here [1]. The pull request is the first step and 
only implements the bare minimum to call an Objective-C instance method.

Hopefully the code should work for iOS as well, the only thing that I 
know of that needs some adjustment is selecting the correct 
objc_msgSend_* function which is different for each architecture. When 
this pull request has been accepted and later implemented in LDC, it 
should be enough as well to start testing.

DMD and LDC share the same front end but the glue code is specific for 
each compiler and needs to be adopted for LDC.

[1] https://github.com/D-Programming-Language/dmd/pull/4321

-- 
/Jacob Carlborg


More information about the digitalmars-d-ldc mailing list