【问题标题】:Is it impossible use invoke in macro defenition in MASM?在 MASM 的宏定义中不可能使用调用吗?
【发布时间】:2014-12-20 07:57:11
【问题描述】:

我正在尝试编写用于打印字符串的宏。此代码工作正常:

include \masm32\include\masm32rt.inc

.const

    enterA  db  "a: ", 0

.code

    main proc

        invoke crt_printf, addr enterA

        invoke ExitProcess, NULL

    main endp

    end main

但是如果我为此定义宏..

include \masm32\include\masm32rt.inc

.const

    enterA  db  "a: ", 0

.code

    input macro tip
        invoke crt_printf, addr tip
    endm

    main proc

        input enterA

        invoke ExitProcess, NULL

    main endp

    end main

所以,我认为不可能在宏中使用调用。为什么?

【问题讨论】:

    标签: assembly masm masm32


    【解决方案1】:

    在宏内部使用invoke 完全没问题。问题是您将宏命名为inputmasm32\macros\macros.asm 中已经有一个具有该名称的宏,它包含在您的代码中的masm32\include\masm32rt.inc 中。因此,只需为您的宏选择一个不同的名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-12
      • 2020-03-05
      • 2011-12-19
      • 1970-01-01
      相关资源
      最近更新 更多