-
-
Save RX14/2bf5cbca185e3b449576523e2e7e188c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lib LibWindows | |
STD_INPUT_HANDLE = 0xFFFFFFF6_u32 | |
STD_OUTPUT_HANDLE = 0xFFFFFFF5_u32 | |
STD_ERROR_HANDLE = 0xFFFFFFF4_u32 | |
alias DWord = UInt32 | |
alias Handle = Void* | |
alias SizeT = UInt64 # FIXME | |
struct Overlapped | |
internal : SizeT* | |
internal_high : SizeT* | |
pointer : Void* | |
event : Handle | |
end | |
fun get_std_handle = GetStdHandle(std_handle : DWord) : Handle | |
fun get_file_type = GetFileType(file : Handle) : DWord | |
fun write_file = WriteFile(file : Handle, buffer : UInt8*, size : DWord, written : DWord*, overlapped : Overlapped*) : Bool | |
fun close_handle = CloseHandle(file : Handle) : Bool | |
end | |
handle = LibWindows.get_std_handle(LibWindows::STD_OUTPUT_HANDLE) | |
str = "Hello World!\n" | |
written = 0_u32 | |
LibWindows.write_file(handle, pointerof(str.@c), str.@bytesize, pointerof(written), nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment