digitalmars.D.learn - Minimal D executable on Windows x32
- RivenTheMage (35/35) Feb 12 2014 Did it just for fun, maybe it will help someone :)
- bearophile (6/7) Feb 12 2014 I have tried it, and it works :-)
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.
Feb 12 2014
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
Feb 12 2014