diff --git a/src/compiler/Result.go b/src/compiler/Result.go index 7c9a7c6..ee73c1c 100644 --- a/src/compiler/Result.go +++ b/src/compiler/Result.go @@ -50,11 +50,14 @@ func (r *Result) finalize() ([]byte, []byte, dll.List) { final.RegisterNumber(asm.MOVE, x64.SyscallInputRegisters[1], 0) final.Syscall() case "windows": + final.RegisterNumber(asm.SUB, x64.RSP, 8) final.RegisterNumber(asm.MOVE, windows.X64InputRegisters[0], 0) final.DLLCall("kernel32.ExitProcess") } - dlls := dll.List{} + dlls := dll.List{ + {Name: "kernel32", Functions: []string{"ExitProcess"}}, + } // This will place the main function immediately after the entry point // and also add everything the main function calls recursively. @@ -80,6 +83,7 @@ func (r *Result) finalize() ([]byte, []byte, dll.List) { final.RegisterNumber(asm.MOVE, x64.SyscallInputRegisters[1], 1) final.Syscall() case "windows": + final.RegisterNumber(asm.SUB, x64.RSP, 8) final.RegisterNumber(asm.MOVE, windows.X64InputRegisters[0], 1) final.Label(asm.DLLCALL, "kernel32.ExitProcess") }