News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

ptr$ macro

Started by sinsi, February 11, 2019, 12:49:00 PM

Previous topic - Next topic

sinsi

Using more than one ptr$() with invoke does not work, since masm expands the ptr$ macro before the invoke macro.

local v1:qword,v2:dword
  invoke target,ptr$(v1),ptr$(v2)
;...
  lea     rax, [rbp-68h]
  lea     rax, [rbp-6Ch]
  mov     rcx, rax
  mov     rdx, rax
  call    target


Any workaround?

hutch--

Use registers for more than one. The macro is only a wrapper for "lea rax, var", mov vptr, rax".

I usually use it for single variables.

mov ptr1, ptr$(var1)
mov ptr2, ptr$(var2)
rcall MyFunc,ptr1,ptr2


With under 5 args, there is a more efficient way.

lea rcx, var1
lea rdx, var2
call MyFunc