The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Titan on August 05, 2005, 11:52:55 PM

Title: Question
Post by: Titan on August 05, 2005, 11:52:55 PM
I want this to be a function, and not a macro:

      Pcall MACRO name:REQ,items:VARARG
        LOCAL arg
        FOR arg,<items>
          push arg
        ENDM
          call name
      ENDM
[quote][/quote]
I get errors that VARARG must be used in C calling convention or something.  Is it possible to make a function out of this?
Title: Re: Question
Post by: hitchhikr on August 06, 2005, 12:10:38 AM
Something like that:


Pcall PROC C Function:dword, Nbr_Items:dword, Items:VARARG
mov eax,Nbr_Items
Push_Params: dec eax
push Items[eax * 4]
jnz Push_Params
call Function
ret
Pcall ENDP


Use it like that:


invoke Pcall, addr myproc, 3, 4, 5, 6