Author Topic: ptr$ macro  (Read 1071 times)


  • Guest
ptr$ macro
« on: February 11, 2019, 12:49:00 PM »
Using more than one ptr$() with invoke does not work, since masm expands the ptr$ macro before the invoke macro.
Code: [Select]
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?


  • Administrator
  • Member
  • ******
  • Posts: 7436
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: ptr$ macro
« Reply #1 on: February 11, 2019, 01:23:34 PM »
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

hutch at movsd dot com    :biggrin:  :skrewy: