Future of D on alternate platforms
Kai Nacke
kai at redstar.de
Wed Feb 26 10:35:54 PST 2014
On Friday, 21 February 2014 at 20:55:58 UTC, Frustrated wrote:
> How difficult is it to port D code to future projects on
> alternate platforms(mainly coming from win) and, if needed be, a
> compiler for those platforms?
>
> At this point, I'm wondering how difficult code I'm writing for
> windows will be to port to, say, the iOS, mac, arm, and more
> likely, embedded systems such as the tigerSharc, etc.
>
> I've heard many times the LLVM compiler mentioned in the forums
> and it seems to be able to compile D code to any platform the
> compiler supports(but somehow independent of D... maybe it
> compiles it to an intermediate language?).
>
> My goal at this point is to use D on windows to create some
> algorithmic software and then potentially port it to some
> embedded system with minimal rewrite of the core code. e.g., I
> don't want to have to rewrite the algorithms in C and use the
> compiler tools for that system. If that was the case there is
> little reason to use D in the first place.
>
> Obviously there is no magic compiler that will do it all. I'm
> curious though as to the possibility. In 2 years could one
> expect
> D to be more widely used on other systems? I see people already
> getting D started on ARM and iOS so it seems feasible that in
> the
> near future it would be relatively easy to port the
> code(obviously there are functional differences due to the OS
> but
> I'm talking about the cpu issues at this point).
Hi Frustrated!
With LDC, you can potential target all platforms supported by
LLVM. The big problem is the runtime support. Some of the modules
are very low-level and you have to implement them for every
platform (e.g. core.thread, the vararg interface or exception
handling).
This is not always easy. On ARM, there is a bug in the exception
handling code. PPC64 has good support (there are still bugs,
too!) but PPC32 requires more work. I currently evaluate if I can
add support for MIPS64, too.
LDC has still a cross-compiling issue with floating points but I
already have a fix for this (which requires more testing before
commit).
If the CPU of your device is already supported by the runtime,
then you can reach your goal. At Phobos level, the biggest
difference between devices is accuracy of real data type (may be
different!).
BTW: Which is your target platform?
Regards,
Kai
More information about the Digitalmars-d
mailing list