January 12, 2018 Druntime: Changing the underlying C Standard Library | ||||
---|---|---|---|---|
| ||||
Hello, I'm writing an operating system in D for some exotic hardware. I understand the D runtime environment depends on a C stdlib being available (at compile time or run time?) As a consequence of the hardware, I need to use our own C std lib for the operating system. How can I set about directing the compiler (or run-time) to non-default implementation? Alternatively, I infer there's nothing breaking about replacing all of core.stdc with an implementation written in -betterC? Thanks, ST. |
January 12, 2018 Re: Druntime: Changing the underlying C Standard Library | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sebastian Trent | On Friday, 12 January 2018 at 03:21:15 UTC, Sebastian Trent wrote: > I'm writing an operating system in D for some exotic hardware. I understand the D runtime environment depends on a C stdlib being available (at compile time or run time?) both > As a consequence of the hardware, I need to use our own C std lib for the operating system. How can I set about directing the compiler (or run-time) to non-default implementation? Same way you would in C itself: instruct the linker to use your runtime instead. On Linux, something like `-L-nostdlib -L-lmy_c_library` should do it. The -L option to dmd passes the rest of the option down to the linker (gcc, which then passes it to ld), so that `-nostdlib` flag is actually one of gcc's. > Alternatively, I infer there's nothing breaking about replacing all of core.stdc with an implementation written in -betterC? core.stdc has no code per se, it is just function prototypes to access the C library. The C library itself is provided externally by the linker. |
Copyright © 1999-2021 by the D Language Foundation