Log in

View Full Version : Help C++ compiling


crUsAdEr
April 8th, 2004, 04:06
OK, i wrote a function in C++ which doesn't do anything much, and here is the compiled results
Code:

.text:00013641 55 push ebp
.text:00013642 8B EC mov ebp, esp
.text:00013644 53 push ebx
.text:00013645 56 push esi
.text:00013646 57 push edi
.text:00013647 60 pusha
.text:00013648 83 3D A8 16 04 00+ cmp dword_416A8, 0
.text:0001364F 74 06 jz short loc_13657
.text:00013651 8B 45 08 mov eax, [ebp+arg_0]
.text:00013654 80 20 EF and byte ptr [eax], 0EFh
.text:00013657
.text:00013657 loc_13657: ; CODE XREF: sub_13641+Ej
.text:00013657 61 popa
.text:00013658 5F pop edi
.text:00013659 5E pop esi
.text:0001365A 5B pop ebx
.text:0001365B 5D pop ebp


The question is how do I tell the compiler to skip all the push esi, pop esi...
All i needed was the pusha and popa...

So what directive do I need?

Thanks

tom324
April 8th, 2004, 15:27
Check compiler options and set optimization level to max.

Tom

disavowed
April 8th, 2004, 18:34
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccelng/htm/msmod_25.asp ("http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccelng/htm/msmod_25.asp")

TQN
April 8th, 2004, 21:31
Hi crUsAdEr !
If you use VC++, you can declare a function with __declspec(naked). For functions declared with the naked attribute, the compiler generates code without prolog and epilog code.
Regards

disavowed
April 8th, 2004, 23:00
tqn: see my post directly above yours

crUsAdEr
April 9th, 2004, 01:02
Thanks, disavowed and everyone else ...
I thought it was naked something but wasnt sure