Paste: hello world for windows, no CRT
Author: | j |
Mode: | text |
Date: | Fri, 20 Aug 2010 00:38:13 |
Plain Text |
// clay -no-exceptions -shared -asm no-crt-win-hello.clay
// gcc -c no-crt-win-hello.s
// ld -o no-crt-win-hello no-crt-win-hello.o -lkernel32
import win32.(GetStdHandle, WriteFile, ExitProcess);
external mainCRTStartup() {
var hStdout = GetStdHandle(UInt(-11));
WriteFile(
hStdout,
RawPointer(cstring("Hello World\n")),
12,
LPDWORD(0),
LPOVERLAPPED(0)
);
ExitProcess(0u);
}
Author: | elrood |
Mode: | text |
Date: | Wed, 25 Aug 2010 17:03:10 |
Plain Text |
// clay -no-exceptions -shared -asm hw.clay
// as hw.s -o hw.o
//
// link /nodefaultlib /entry:mainCRTStartup /align:16 hw.o /out:hw.exe kernel32.lib /merge:.data=.text /merge:.dtors=.text /subsystem:console
// 848 bytes (896)
//
// polink /nodefaultlib /entry:mainCRTStartup /align:16 hw.o /out:hwp.exe kernel32.lib /merge:.data=.text /merge:.dtors=.text
// 640 bytes (688)
// numbers in parens with exitprocess call
import win32.*;
external mainCRTStartup() {
WriteFile(
GetStdHandle(UInt(-11)),
RawPointer(cstring("Hello World\n")),
DWORD(12),
LPDWORD(0),
LPOVERLAPPED(0)
);
ExitProcess(0u);
}
Author: | elrood |
Mode: | text |
Date: | Wed, 25 Aug 2010 18:16:04 |
Plain Text |
kernel32.def
-----
LIBRARY kernel32.dll
EXPORTS
_ExitProcess@4 @183
_GetStdHandle@4 @433
_WriteFile@20 @913
-----
polib /out:kernel32.lib /def:kernel32.def
New Annotation