mirror of
https://github.com/janet-lang/janet
synced 2025-10-29 06:37:41 +00:00
x64 allow dynamically switching between windows and sysv target.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
janet.exe examples/sysir/samples.janet > temp.nasm
|
||||
janet.exe examples/sysir/windows_samples.janet > temp.nasm
|
||||
nasm -fwin64 temp.nasm -l temp.lst -o temp.o
|
||||
link /entry:Start /subsystem:windows kernel32.lib user32.lib temp.o /out:temp.exe
|
||||
temp.exe
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
build/janet examples/sysir/samples.janet > temp.nasm
|
||||
valgrind build/janet examples/sysir/samples.janet > temp.nasm
|
||||
nasm -felf64 temp.nasm -l temp.lst -o temp.o
|
||||
ld -o temp.bin -dynamic-linker /lib64/ld-linux-x86-64.so.2 -lc temp.o
|
||||
valgrind ./temp.bin
|
||||
|
||||
@@ -38,24 +38,13 @@
|
||||
(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 winmain)
|
||||
(compile1 square)
|
||||
(compile1 simple)
|
||||
(compile1 myprog)
|
||||
(compile1 doloop)
|
||||
(compile1 main-fn)
|
||||
#(dump)
|
||||
#(dumpc)
|
||||
(dumpx64)
|
||||
|
||||
# Run with
|
||||
# janet examples/sysir/scratch.janet > temp.nasm && nasm -felf64 temp.nasm -l temp.lst && ld temp.o && ./a.out
|
||||
|
||||
14
examples/sysir/windows_samples.janet
Normal file
14
examples/sysir/windows_samples.janet
Normal file
@@ -0,0 +1,14 @@
|
||||
(use ./frontend)
|
||||
|
||||
(def winmain
|
||||
'(defn Start:void []
|
||||
(MessageBoxExA (the pointer 0) "Hello, world!" "Test" 0 (the s16 0))
|
||||
(ExitProcess (the int 0))
|
||||
(return)))
|
||||
|
||||
####
|
||||
|
||||
(compile1 winmain)
|
||||
#(dump)
|
||||
#(dumpc)
|
||||
(dumpx64)
|
||||
Reference in New Issue
Block a user