Working LDC iOS (iPhone) on github

Jacob Carlborg doob at me.com
Sat Feb 15 02:47:46 PST 2014


On 2014-02-15 07:44, Dan Olson wrote:

> David talked about doing something like that.  BTW (and aside), does dmd
> still emulate tls on OSX?

Yes, it still emulates. I think we need to decide if we are willing to 
remove the support for OS X 10.6.

I want to add that I think it's theoretically possible to implement the 
TLS support code located in the dynamic linker in druntime. This would 
allow us to move to native TLS on OS X 10.7 while still supporting 10.6, 
with the same code.

> If so, is someone planning to switch it to OSX's thread locals?

I would guess that's the plan, eventually. It's basically a requirement 
for making dynamic libraries work. It's the same as with everything 
else, someone needs to commit time to make it happen.

> Jacob, it looks like you have been playing with D on Mac for awhile.

I certainly have :)


> I searched D forums for iOS or Mac stuff and your name comes up.  I think
> as a next step (pun intended) it would be cool to try something you have
> done to interface D with the objc world.  For now, I am just creating C
> functions as needed to glue objc messages to D.
>
> Also started playing some with the ObjC Runtime calls like
>
>    objc_msgSend(obj, sel_registerName("release"))
>
> to do stuff like
>
>    [obj release];
>
> That could go along way with some handy wrapper functions.  Then there
> is the project I think you mentioned to make D compiler directly support
> objc interfaces.

I just have started to work on the 64bit support for D/Objective-C [1] 
(same runtime as iOS).

> Would it be much work to fold it into the current compiler?

Unfortunately yes. The 32bit version is currently very usable. It 
basically only missing support for categories and blocks. For the 64bit 
version only the most basic functionally like: calling instance methods, 
class methods and implementing Objective-C classes on the D side. What's 
missing in the 64bit version is:

* Categories
* Protocols (interfaces)
* Catching exceptions (I have a workaround for this that I think is working)
* Properties
* All that's missing in the 32bit version

Non of the version supports ARC.

Except from all the missing features it would most likely require quite 
a lot of work to get the code approved and merged. There are quite a lot 
of changes in most of the phases in the compiler. Adding new syntax to 
the language is a high barrier.

If you want to use D/Objective-C you can DStep [2] to create bindings.

> Anyway, looking forward to any tools or thoughts you have.  For now,
> exception handling seems the most useful missing feature.  So I am
> looking at that.

[1] https://github.com/jacob-carlborg/dmd/tree/d-objc-64
[2] https://github.com/jacob-carlborg/dstep

-- 
/Jacob Carlborg


More information about the digitalmars-d-ldc mailing list