Minimal D executable on Windows x32
RivenTheMage
riven-mage at id.ru
Wed Feb 12 06:05:33 PST 2014
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.
More information about the Digitalmars-d-learn
mailing list