-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.arc
37 lines (26 loc) · 832 Bytes
/
example.arc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Int16 : Int -32_768 .. 32_767;
Int32 : Int -2_147_483_648 .. 2_147_483_647;
BOOL : Int32;
DWORD : Int32;
HANDLE : ()*;
STD_OUTPUT_HANDLE := -11;
extern (C) GetStdHandle : DWORD -> HANDLE;
extern (C) WriteConsole : (HANDLE, Int16*, Int, Int*, ()*) -> BOOL;
main := (args: String[]) {
str := "Hello World"w;
stdout := GetStdHandle STD_OUTPUT_HANDLE;
WriteConsole(stdout, &(str 0), str.length, null, null);
}
/* D equivalent
alias BOOL = int;
alias DWORD = int;
alias HANDLE = void*;
enum STD_OUTPUT_HANDLE = -11;
extern (C) HANDLE GetStdHandle(DWORD);
extern (C) BOOL WriteConsole(HANDLE, wchar*, int, int*, void*);
void main(string[] args) {
auto str = "Hello World"w;
auto stdout = GetStdHandle(STD_OUTPUT_HANDLE);
WriteConsole(stdout, &str[0], str.length, null, null);
}
*/