Hi,

Sometimes, when you put code, you use
option PROLOGUE:none
option EPILOGUE:none

What do these option consist on ?

What are the advantages / disavantages of these options ? When must i use them ?

In fact, i wrote a simple function and generate a .lib file... It was smaller with these options...

Can you explain me please ?

Thanks

I read the masm32 help file for these options, but i did not really understand them.
Posted on 2003-01-23 17:53:16 by DarkEmpire
http://www.asmcommunity.net/board/index.php?topic=6254&highlight=PROLOGUE

Sometimes you might want to use the convienence of the INVOKE syntax, but don't want the overhead of PROLOGUE/EPILOGUE - so, you turn it off with:
OPTION PROLOGUE:NONE

OPTION EPILOGUE:NONE
...and then turn back on the defaults:
OPTION PROLOGUE:PROLOGUEDEF

OPTION EPILOGUE:EPILOGUEDEF
The downside is that you have to manually access stack parameters - using the names in the PROC definition is not going to work because EBP is not set if they are turned off.

For example, we have a PROC:
testP PROC uses ebx, xxx:DWORD

mov ebx, xxx
inc ebx
mov eax, ebx
ret
testP ENDP
With the default PROLOGUE/EPILOGUE MASM generates:
testP:

; PROLOGUE
push ebp
mov ebp, esp
push ebx

mov ebx, [ebp + 8]
inc ebx
mov eax, ebx

; EPILOGUE
pop ebx
mov esp, ebp
pop ebp
ret 4
(or something similar - use your debugger) :)

Without PROLOGUE/EPILOGUE it would just be:
testP:

mov ebx, [ebp + 8]
inc ebx
mov eax, ebx
ret
...see, EBP isn't set to anything and EBX isn't saved on the stack. You would have to code it manually:
OPTION PROLOGUE:NONE

OPTION EPILOGUE:NONE

testP PROC xxx:DWORD
push ebx
mov ebx, [esp+8]
inc ebx
mov eax, ebx
pop ebx
ret 4
testP ENDP

OPTION PROLOGUE:PROLOGUEDEF
OPTION EPILOGUE:EPILOGUEDEF
...and you can still: invoke testP, 123

Why would you do this? More control.

Additionally, you can create your own PROLOGUE/EPILOGUE
Posted on 2003-01-23 19:01:34 by bitRAKE