2
votes

I want to ask if there's any way to 'inline' function in MASM? I'm looking for some macro equivalent, I want to do something like:

poly PROC
    procbeg:
         push ebp
         mov ebp, esp
         xor eax, eax
         jz lol
         db 0eah
         lol:
         pop ebp
         retn
    procend:
poly ENDP


main PROC

    call poly   
    invoke ExitProcess, 0
main ENDP         
END main

I want to do something, so asembler will replace call poly with body of function poly, this is simple example, I want to do something similar as in C/C++ inline means.

1

1 Answers

3
votes

You should be able to use Macros:

inline_poly macro
    procbeg:
     push ebp
     mov ebp, esp
     xor eax, eax
     jz lol
     db 0eah
     lol:
     pop ebp
     retn
    procend:
inline_poly endm

and then instead of call you just:

main PROC

    inline_poly   
    invoke ExitProcess, 0
main ENDP