iphone + LDC, a new ARM adventure

Dan Olson zans.is.for.cans at yahoo.com
Tue Feb 4 23:32:04 PST 2014


> Or maybe the next step is to rebuild phobos using the ldc/llc two phase
> approach.

Success building phobos this way and was able to writeln() to the Xcode
console from iPhone 4.  Again, druntime rt_init() and D functions are
called by the iOS app's C main (not using dmain2 main).

In the process, I discovered that std.stdio was uninitialized because
module constructors are not being called by rt_init().  Something in the
runtime sections OSX code that does not work for iOS.  Oh, well, add to
the todo list.  However, found I could manually initialize std.stdio
with std_stdio_static_this().

--- dfun.d ---
import std.stdio;

extern(C) void std_stdio_static_this();

extern(C) int dfun()
{
    // static this in std.stdiobase isn't it called automatically? Need to
    // figure it out.  In meantime, just do it!
    std_stdio_static_this();

    writeln("Hello phobos");
    return 2014;
}

All the LEGO blocks are there in ldc to build a D toolchain for iOS.
Over the next few weeks I will put up stuff on github along with a todo
list.  I am not very good with Xcode so any thoughts on how to integrate
would be nice.

The tolist will look something like:
- fix module ctors/dtors
- version info for iOS (now using OSX && ARM, but not sure that makes
   sense?  Use darwin && ARM?, or create new IOS version?)
- exception support
- thread support
- tls support
- run (and pass) unittests
- figure out ldc codegen assertion errors for armv7/thumbv7 so can ditch
   the ldc/llc 2-phase approach.

that is enough for now.
-- 
Dan


More information about the digitalmars-d-ldc mailing list