February 12, 2014 Minimal D executable on Windows x32 | ||||
---|---|---|---|---|
| ||||
Did it just for fun, maybe it will help someone :) Requires UniLink: ftp://ftp.styx.cabel.net/pub/UniLink main.d -------- extern(C) void _acrtused_con() { mainFunc(); } extern(Windows) { int MessageBoxA(uint hWnd, char* lpText, char* lpCaption, uint uType); void ExitProcess(uint uExitCode); } void mainFunc() { MessageBoxA(0, cast(char*) "Hello, World!".ptr, cast(char*) "Nano-D".ptr, 0); ExitProcess(0); } -------- object.d -------- module object; struct ModuleInfo { // nothing } -------- Compiling: dmd -c main.d Linking: ulink.exe -e__acrtused_con -L{YOUR_PATH_TO_DMD}\windows\lib -zkernel32;user32 main.obj Size of main.exe is 1068 bytes. |
February 12, 2014 Re: Minimal D executable on Windows x32 | ||||
---|---|---|---|---|
| ||||
Posted in reply to RivenTheMage | RivenTheMage:
> Size of main.exe is 1068 bytes.
I have tried it, and it works :-)
Seems useful using the -betterC switch discussed in the main D newsgroup.
Bye,
bearophile
|
Copyright © 1999-2021 by the D Language Foundation