首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >masm32调用标准输出不会给出任何输出

masm32调用标准输出不会给出任何输出
EN

Stack Overflow用户
提问于 2013-10-03 03:01:47
回答 1查看 2.8K关注 0票数 1

我正在使用masm32在windows7上编译和链接,它在下面的代码中工作得很好。然而,调用stdOut并不是简单地在我的命令提示符上打印任何东西。我做错了什么?

代码语言:javascript
复制
.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
EN

回答 1

Stack Overflow用户

发布于 2013-10-03 03:14:34

解决..。我为链接器使用了错误的参数

如何正确链接

代码语言:javascript
复制
ml /c /coff /Cp hello.asm
link /subsystem:console /libpath:c:\masm32\lib hello.obj

如何不链接此程序

代码语言:javascript
复制
ml /c /coff /Cp hello.asm
link /subsystem:windows /libpath:c:\masm32\lib hello.obj
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19144764

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档