News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Macro problem

Started by ragdog, January 28, 2013, 10:31:10 PM

Previous topic - Next topic

ragdog

Hello

I use a macro but it give me this error messages
": warning A4006: too many arguments in macro call"
Macro Called From
Main Line Code


Initvars macro args:vararg
for arg,<args>
invoke Initvar,0
mov &arg,eax
endm
InitDestroys macro
for arg,<args>
invoke InitDestroy,&arg
endm
endm
exitm<>
endm


Initvars(buff)
InitDestroys()

Initvar proc argv:DWORD
;bla
ret
Initvar endp

InitDestroy proc argv:DWORD
;bla
ret
InitDestroy endp


Have your an idea?

Regards,

qWord

InitDestroys is a procedural macro, but you call it like a function. Either use EXITM <> in InitDestroys  or remove the bracket in the call.
MREAL macros - when you need floating point arithmetic while assembling!

ragdog

Thanks for your reply

Mean you this exitm<> here?


Initvars macro args:vararg
for arg,<args>
invoke Initvar,0
mov &arg,eax
endm
InitDestroys macro
for arg,<args>
invoke InitDestroy,&arg
endm
               exitm<> ;<<<<<<<<<<<<<<<<<<<<<<
endm
exitm<>
endm


and must i define the buff varibale in InitDestroys or works without?

Initvars(buff)
InitDestroys()

qWord

Quote from: ragdog on January 28, 2013, 11:12:39 PMMean you this exitm<> here?
yes

Quote from: ragdog on January 28, 2013, 11:12:39 PM
and must i define the buff varibale in InitDestroys [...]?
does not sound useful.
MREAL macros - when you need floating point arithmetic while assembling!

ragdog

Example

Must i use

InitDestroys() or InitDestroys(buff) ?

qWord

It is not clear what you want to do exactly.
Initvars macro args:vararg
for arg,<args>
;.data? ; alternative: define variables in macro
; arg dd ?
;.code
invoke Initvar,0
mov &arg,eax
endm
InitDestroys macro
for arg,<args>
invoke InitDestroy,&arg
endm
exitm <>
endm
exitm<>
endm

;...

.data?
buff1 dd ?
buff2 dd ?
.code

Initvars(buff1,buff2)
;...
InitDestroys()
MREAL macros - when you need floating point arithmetic while assembling!