1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-06 02:23:03 +00:00

Working examples on windows.

Add some support for windows x64 ABI.
This commit is contained in:
Calvin Rose
2024-06-17 07:07:20 -07:00
parent cdb3baaca3
commit e5765b26d4
7 changed files with 207 additions and 99 deletions

View File

@@ -57,6 +57,7 @@
(add-prim-type 'long 's64)
(add-prim-type 'pointer 'pointer)
(add-prim-type 'boolean 'boolean)
(add-prim-type 's16 's16)
(sysir/asm ctx into)
ctx)

View File

@@ -1,4 +1,4 @@
janet.exe examples/sysir/samples.janet > temp.nasm
nasm -fwin64 temp.nasm -l temp.lst -o temp.o
link temp.o legacy_stdio_definitions.lib msvcrt.lib /out:temp.exe
link /entry:Start /subsystem:windows kernel32.lib user32.lib temp.o /out:temp.exe
temp.exe

View File

@@ -32,19 +32,27 @@
(return x)))
(def main-fn
'(defn WinMain:void []
'(defn _start:void []
#(syscall 1 1 "Hello, world!\n" 14)
(doloop 10 20)
(exit (the int 0))
(return)))
(def winmain
'(defn Start:void []
(MessageBoxExA (the pointer 0) "Hello, world!" "Test" 0 (the s16 0))
(ExitProcess (the int 0))
(return)))
####
#(compile1 square)
(compile1 simple)
(compile1 myprog)
(compile1 doloop)
(compile1 main-fn)
#(compile1 simple)
#(compile1 myprog)
#(compile1 doloop)
#(compile1 main-fn)
(compile1 winmain)
#(dump)
#(dumpc)
(dumpx64)