nasm 的 "Hello, world" 在 Windows 10 x64 上
环境
操作系统:

nasm 版本:
PS C:\Users\xxxx> nasm -version
NASM version 2.16.03 compiled on Apr 17 2024
link 版本:
PS C:\Users\xxxx\Downloads\18176\1\3\2> link
Microsoft (R) Incremental Linker Version 14.29.30159.0
Copyright (C) Microsoft Corporation. All rights reserved.
Code
default rel
extern printf
section .data
msg db 'Hello, World', 0
fmt db '%s', 0
section .text
global main
main:
sub rsp ,0x28
lea rcx, [fmt]
lea rdx, [msg]
call printf
add rsp, 0x28
ret
编译
PS C:\Users\xxxx\Downloads\18176\1\3\2> nasm -f win64 .\hello.asm -o .\hello.obj
PS C:\Users\xxxx\Downloads\18176\1\3\2> link .\hello.obj libcmt.lib
Microsoft (R) Incremental Linker Version 14.29.30159.0
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\Users\xxxx\Downloads\18176\1\3\2> .\hello.exe
Hello, World

浙公网安备 33010602011771号