我是編程的菜鳥。
我想寫一個程式在 64 位 masm 中顯示你好。
我將 VS 代碼與 ml64.exe 和 gcc 一起使用。
以下是我寫的:
;; file name: hello.asm
printf proto
.data
messenge dq "hello", 0
.code
main proc
sub rsp, 40h
mov rcx, messenge
call printf
add rsp, 40h
ret
main endp
end
我撰寫了一個腳本來組裝、鏈接和執行:
@:: file name: run.cmd
@ml64 /c hello.asm
@gcc -o hello.exe hello.obj
@del *.obj
@hello.exe
它是這樣的:
C:\code\MASM>run.cmd
Microsoft (R) Macro Assembler (x64) Version 14.25.28614.0
Copyright (C) Microsoft Corporation. All rights reserved.
Assembling: hello.asm
它沒有輸出你好字串。
我該如何解決?
uj5u.com熱心網友回復:
我只用ml64 hello.asm(沒有 gcc)來構建它。
;; file name: hello.asm
printf proto
includelib msvcrt.lib
includelib legacy_stdio_definitions.lib
.data
messenge db "hello", 13, 0
.code
main proc
sub rsp, 40h
mov rcx, offset messenge
call printf
add rsp, 40h
ret
main endp
end
基本上就是邁克爾所說的。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/408731.html
標籤:
上一篇:這組指令有什么作用?
