Porting D to custom OS
Denis Feklushkin
feklushkin.denis at gmail.com
Mon Feb 24 06:22:17 UTC 2020
On Saturday, 22 February 2020 at 13:20:40 UTC, IGotD- wrote:
> I'm trying to find information how to port D, especially the D
> runtime to a proprietary OS.
Here is my "Frankenstein" MCU project:
https://github.com/denizzzka/d_c_arm_test
Maybe this will help you somehow.
It is forced to use simultaneously: ldc2, clang, gcc, make,
meson. Currently it uses ARM but also I interested in RISC-V.
It almost works except druntime.
> Will there be a future improvement of this so that OS specific
> support can be moved to separate files and selected on module
> level instead?
Hurrah! I come by search with same idea!
I looked into druntime for several days (and never before) and
now I think that tree of its source code isn't organized properly
and this stucks porting it to architectures very different from
well-known Posix.
For example, look:
https://github.com/dlang/druntime/blob/master/src/core/stdc/errno.d
https://github.com/dlang/druntime/blob/master/src/core/stdc/stdio.d
Without moving out of architecture-dependent code into separate
"subprojects" it is impossible to imagine that this code can be
ported without significant labor costs.
Also, such a takeaway is necessary because by "architecture" we
can mean identical "CPU + OS" bundles but just with different
definitions of modern types like int_fast16_t and so on -
thousands of "architectures"! This is actual for MCU.
Moreover, it would be nice to make as much as possible any parts
of this "backend" optional. Let a compilation error happens if
there is no some functionality. Then these talks about a certain
"minimal druntime", which, in fact, provides abilities what
already gives betterC, will stop.
Perhaps this proposal isn't new, but the search yielded nothing
except your message.
More information about the Digitalmars-d-learn
mailing list