digitalmars.D.learn - Compile to non-OS binary
- Amorphorious (16/16) Dec 23 2017 I would like to compile D for the different supported
- Amorphorious (18/18) Dec 23 2017 Premature send(tabs?!?! ;/)
- Adam D. Ruppe (10/13) Dec 23 2017 The way I did it was create a custom runtime only including the
- Amorphorious (9/22) Dec 24 2017 Thanks.
I would like to compile D for the different supported architectures only without and OS, C lib, D lib, or GC code. For example, as a boot loader or even bios binary. In fact, it would be very helpful to have switches that disable the various "features" of D that I will not use rather than having to do any self compilation. Ultimately LDC and/or GDC will be required for optimized binaries with the same limitations. For testing purposes I would also like the ability to compile to the OS PE structure. For example import BIOS; void main() { BIOSOut("Hello World"); } will output
Dec 23 2017
Premature send(tabs?!?! ;/) void main() { version(BIOS) { import iBIOS; BIOSOut("Hello World"); } else { writeln("Hello World"); } } When compiled appropriately will create a bootable executable that displays the string. Else will create an OS specific executable that prints the string. (for demo purposes only) This should be seamless as I will be switching functionality regularly.
Dec 23 2017
On Sunday, 24 December 2017 at 03:15:58 UTC, Amorphorious wrote:In fact, it would be very helpful to have switches that disable the various "features" of D that I will not use rather than having to do any self compilation.The way I did it was create a custom runtime only including the features I wanted, then use `-defaultlib=` to disable linking in the library.. There's also the `-betterC` switch that will skip things like this too. This is my old code, but emphasis on old, I haven't updated it for over a year and runtime hacks like this tend to need tweaks to keep working http://arsdnet.net/dcode/minimal.zip I believe gdc also has several flags to disable individual features.
Dec 23 2017
On Sunday, 24 December 2017 at 03:24:36 UTC, Adam D. Ruppe wrote:On Sunday, 24 December 2017 at 03:15:58 UTC, Amorphorious wrote:Thanks. We can remove phobos easily but the runtime must be custom, which requires recompiling with the appropriate compilers. How much hacking have you had to do? is it mainly just removing bits of code or did you have to do extensive work? and if so, what areas, if you recall? Did you having any major problems messing around with this stuff or is it pretty straight forward?In fact, it would be very helpful to have switches that disable the various "features" of D that I will not use rather than having to do any self compilation.The way I did it was create a custom runtime only including the features I wanted, then use `-defaultlib=` to disable linking in the library.. There's also the `-betterC` switch that will skip things like this too. This is my old code, but emphasis on old, I haven't updated it for over a year and runtime hacks like this tend to need tweaks to keep working http://arsdnet.net/dcode/minimal.zip I believe gdc also has several flags to disable individual features.
Dec 24 2017