Hyperlink x86 masm hello world
我正试图用ML在windows上编译一个hello world,并将其链接到VS 2010Hyperlink x86 masm hello world,hyperlink,x86,masm,Hyperlink,X86,Masm,我正试图用ML在windows上编译一个hello world,并将其链接到VS 2010 .MODEL FLAT .STACK 4096 .data msg db "Hello World!",0 .code INCLUDELIB MSVCRT EXTRN printf:NEAR EXTRN exit:NEAR PUBLIC _main _main PROC mov eax, offset msg push eax call printf mov eax,0 push eax call exi
.MODEL FLAT
.STACK 4096
.data
msg db "Hello World!",0
.code
INCLUDELIB MSVCRT
EXTRN printf:NEAR
EXTRN exit:NEAR
PUBLIC _main
_main PROC
mov eax, offset msg
push eax
call printf
mov eax,0
push eax
call exit
_main ENDP
END _main
我不断收到链接器错误,说printf和exit是未解析的外部符号。我有几个问题
VC\crt\src\crt0.c
要不依赖CRT,您必须使用OS API。对于Win32,这将是Win32函数,例如WriteFile(文件句柄为GetStdHandle(STD_OUTPUT_HANDLE))。请参阅一些示例。您好,Igor,您能告诉我如何与_mtinit,_ioinit。。。我尝试了cl/MT final.obj/link kernel32.lib msvcrt.lib,但它无法工作。。。
.386
.MODEL FLAT
.STACK 4096
.data
msg db "Hello World!",0
.code
INCLUDELIB LIBCMT
EXTRN _printf:NEAR
EXTRN _exit:NEAR
EXTRN __heap_init:NEAR
EXTRN __mtinit:NEAR
EXTRN __ioinit:NEAR
PUBLIC _main
_main PROC
push 1
call __heap_init
add esp, 4
push 1
call __mtinit
add esp, 4
call __ioinit
mov eax, offset msg
push eax
call _printf
pop ecx
mov eax,0
push eax
call _exit
_main ENDP
END _main