2013-10-02 5 views
1

masm32를 사용하여 컴파일하고 Windows 7에서 링크 할 수 있습니다.이 코드는 아래 코드와 잘 작동합니다. 그러나 stdOut을 호출하는 것은 단순히 내 명령 프롬프트에 아무 것도 인쇄하지 않습니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?masm32는 stdout을 호출하지 않고 출력합니다.

.386 

.model flat, stdcall 
    option casemap:none 

    include C:\masm32\include\windows.inc 
    include C:\masm32\include\kernel32.inc 
    include C:\masm32\include\user32.inc 
    include C:\masm32\include\masm32.inc 

    includelib C:\masm32\lib\kernel32.lib 
    includelib C:\masm32\lib\user32.lib 
    includelib C:\masm32\lib\masm32.lib 

.data  
    MsgBoxCaption db "Message Box Caption", 0 
    MsgBoxText  db "Win32 Assembly is great!", 0 

.data? 
    ; declare an uninitialized byte, referred to as location sum 
    sum    dd ? 

.code 
    start:  
     mov eax, 1d 
     mov ebx, 1d 

     ; result will be stored in the first argument 
     add eax, ebx 

     ; push eax onto the stack 
     push eax 

     ; pop value into sum 
     pop sum 

     ; invoke MessageBox, NULL, addr MsgBoxText, addr MsgBoxCaption, MB_OK 

     invoke StdOut, addr MsgBoxCaption 
     invoke StdOut, addr sum 

     ; exit with status code 0 
     invoke ExitProcess, 0 
    end start 

답변

1

내가 링커에 대한 잘못된 매개 변수를 사용했다 ... 해결

이 제대로이 프로그램을 연결하는 NOT 방법

ml /c /coff /Cp hello.asm 
link /subsystem:console /libpath:c:\masm32\lib hello.obj 

그것을 연결하는 방법

ml /c /coff /Cp hello.asm 
link /subsystem:windows /libpath:c:\masm32\lib hello.obj