문제

I have a function in C & C++ that looks like:

__declspec(dllexport) bool CreateSocket(SSLSocket* ssl_info);

I believe that by default should use the cdecl calling convention.

If in assembly I import the module and do:

push sockinfo
call [CreateSocket]

Do I have to do: add esp, 0x04 to restore the stack? Or is it restored automatically because it is an imported function? I ask this because for printf which is cdecl convention and imported, I have to clean up the stack myself. For WINAPI I don't have to do that.

Do I have to do this for exported/all functions or just for functions I write myself?

도움이 되었습니까?

해결책

The cleanup responsibility is the same whether the function is imported or integrated in the calling module. It's the calling convention alone that dictates who should do the cleanup.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top