About WinMain

angelface 2003-10-18 08:04:36
调用的时候有时候是WINAPI 有时候是PASCAL, 有什么区别?
...全文
29 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
made_in_ 2003-10-18
  • 打赏
  • 举报
回复
操作系统的调用和参数入栈方式不一样。
Jinhao 2003-10-18
  • 打赏
  • 举报
回复
PASCAL != WINAPI
VC是不支持 _pascal的,所以你在vc提供的windef.h中就会发现 #define PASCAL __stdcall
换句话说,在VC中 PASCAL == WINAPI !
例如,gcc支持 _pascal,所以在Dev-C++提供的windef.h中你会发现 #define PASCAL _pascal

microhard 2003-10-18
  • 打赏
  • 举报
回复
也就是说PASCAL == WINAPI ??
Wolf0403 2003-10-18
  • 打赏
  • 举报
回复
The __pascal, __fortran, and __syscall calling conventions are no longer supported. You can emulate their functionality by using one of the supported calling conventions and appropriate linker options.

WINDOWS.H now supports the WINAPI macro, which translates to the appropriate calling convention for the target. Use WINAPI where you previously used PASCAL or __far __pascal.

SDK 的 windef.h 里面定义的
#elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
#define CALLBACK __stdcall
#define WINAPI __stdcall
#define WINAPIV __cdecl
#define APIENTRY WINAPI
#define APIPRIVATE __stdcall
#define PASCAL __stdcall
都是 __stdcall 了。
Jinhao 2003-10-18
  • 打赏
  • 举报
回复
#define PASCAL _pascal :第一个参数在高位地址
#define WINAPI __stdcall :第一个参数在低位地址,将参数压栈是按C语言的顺序(从右到左)

69,364

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧