I know the windows api functions preserve ebx esi and edi but what about the C standard library functions. Do they preserve any of the registers?
Posted on 2003-11-05 10:14:19 by Odyssey

I know the windows api functions preserve ebx esi and edi but what about the C standard library functions. Do they preserve any of the registers?


Most C/C++ compilers on the x86 follow the Intel ABI.
Therefore, they are free to wipe out EAX, ECX, and EDX on any function call and must
preserve all other registers.

Of course, if you're using a *really old* compiler, it may not follow the Intel ABI. All modern, commercial, compilers do, however. BTW, this is generally true for all languages, not just C/C++. But, of course, YMMV.
Cheers,
Randy Hyde
Posted on 2003-11-05 13:13:00 by rhyde
Thank you, there two c dlls i know of on my system. crtdll.dll and msvcrt.dll. These should be okay to use?
Posted on 2003-11-05 13:20:25 by Odyssey

Thank you, there two c dlls i know of on my system. crtdll.dll and msvcrt.dll. These should be okay to use?

Yes.
Posted on 2003-11-05 18:44:27 by rhyde