D with minimal runtime
IGotD-
nise at nise.com
Wed Jun 17 10:39:38 UTC 2020
On Wednesday, 17 June 2020 at 02:09:47 UTC, dangbinghoo wrote:
>
> many pepole is requiring that the D runtime needs to be
> minimal. Yes, this "is a linking problem" just if you're always
> using "normal" or "rich" OS, things matter if you trying to
> using D in the microcontroller target such as STM32F4 or
> something similar, these platfrom has hundreds of KB ram and
> maybe 1MB of flash memory, it's powerfull enogh for running the
> D language.
>
> if you trying to build a betterC programing on these
> platforms(only RTOS or no OS at all), it shows that D runtime
> is requring some thing that only Rich-OS have.
>
> the rust and zig programming language is doing better in this
> situation, the D runtime can be made only need to requiring
> ANSI C stdlib (like nim 'any') and then the D runtime is more
> portable.
>
>
> thanks!
> ----
> binghoo dang
Indeed and it is not only about "not linking in what you don't
need" as the druntime expects a lot of things from the OS. This
includes reading elf section information, which shouldn't be
needed in a minimal system as we don't even know if the
programmer wants to use elf/pe. Maybe the programmer just want to
use a binary blob. Typically RTOS in small platforms like STM32F4
or similar often don't implement TLS. For these kind of systems
it would be nice if druntime didn't have any TLS variables at all
and then the programmer must promise not to use any TLS
variables. Essentially where you obtain the TLS area for each
thread must be stubbed and just report empty TLS area.
Full D isn't really adapted for limited OS/RTOS today and it has
painted itself into a corner by implementing a lot of expected OS
support in the druntime. There isn't any wrong with it, it's just
that D isn't a systems programming language and the question is
if D should go that route. I'd say that D missed that train and D
shouldn't peruse that any further.
More information about the Digitalmars-d
mailing list