What does a “CALLBACK” declaration in C do?

后端 未结 4 1949
Happy的楠姐
Happy的楠姐 2020-12-01 18:47

I was looking through some code from the SDL library and came across a function declared like this:

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wPar         


        
4条回答
  •  死守一世寂寞
    2020-12-01 19:37

    It's the calling convention. It's required when you pass a pointer to this function to a Windows API which later calls that function. The Windows calling convention is different from the C calling convention, therefore you need to specify to the compiler that WndProc() is special, and that it needs different startup and cleanup code.

提交回复
热议问题