본문 바로가기
VisualStudio.C++.C#/코딩팁,함수활용,단편

calling convention. __cdecl, __stdcall . 호출규약

by i.got.it 2019. 5. 13.

__cdecl, __stdcall 

함수 호출규약이라 부르는 것이며, 2개 의 가장 큰 차이점은 스택 지우기 처리 주체가 다르다는 점.

__cdecl : 함수 호출한 곳에서 스택지움. 

__stdcall : 해당함수가 스택지움. 

 

/// __stdcall
void __stdcall myFunction()
{
...
}

/// __cdecl
void __cdecl myFunction()
{
...
}

//// 명시하지 않으면? __cdecl이 적용됨. 
void  myFunction()
{
...
}

 

DLL 노출함수에서 __stdcall 지정하는 코드. 

__declspec(dllexport) int __stdcall myFunction()
{
...
}

/// __stdcall 을 기록하지 않으면  __cdecl 적용됨.
__declspec(dllexport) int myFunction()
{
...
}

DLL 에서는 지정하지 않으면 기본 __stdcall 이 적용된다는 말들도 있으나,  __stdcall 지정하지 않고 시험해보면 __cdecl 처럼 작동한다고함 

https://cboard.cprogramming.com/windows-programming/28103-__declspec-dllexport-__stdcall.html

 

__declspec(dllexport) and __stdcall

"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

cboard.cprogramming.com

 

 

 

 


첫등록 :  2019년 5월 13일 

최종수정 : 

 

본 글 단축주소 : https://igotit.tistory.com/2165

 


 

댓글



 

비트코인




암호화폐       외환/나스닥/골드       암호화폐/외환/나스닥/골드 암호화폐/외환/나스닥/골드   암호화폐/외환/나스닥/골드
     
현물 |선물 인버스 |선물 USDT       전략매니저(카피트레이딩)     롤오버 이자 없는 스왑프리계좌
( 스왑프리 암호화폐도 거래 가능 )    
MT4, MT5 , cTrader 모두 지원     FTMO 계좌 매매운용. MT4,MT5