Search code examples
assemblymasmmasm32

Is it impossible use invoke in macro defenition in MASM?


I'm trying to write macros for printing string. This code works fine:

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

But if I define macros for this..

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

So, I think that it is not possible to use invoke in macro. Why?


Solution

  • It's perfectly ok to use invoke from inside a macro. The problem is that you named your macro input. There's already a macro with that name in masm32\macros\macros.asm, which is included by masm32\include\masm32rt.inc, which is included by your code. So just pick a different name for your macro.