是什么WINAPI代表 [英] what does WINAPI stand for

查看:229
本文介绍了是什么WINAPI代表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始学习的Win32 API中的C.
我看到的主要功能是一样的东西。

I've started to learn Win32 API in C. I saw that the main function is something like

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow) { .. }

但我知道,在C函数像

but I know that a function in C is like

[ReturnType] [FunctionName] (Args) { .. }

在这种情况下,返回类型为int和函数名的WinMain。
那么,是什么在WINAPI代表和有必要吗?

In this case the return type is int and the function name is WinMain. So what does the WINAPI stand for and is it necessary?

感谢您。 :)

推荐答案

它指定调用年会,该是多么函数的参数都放在和栈进行管理。

It's specifying the calling convention, which is how arguments to functions are placed and managed on the stack.

您可以混合调用约定,说如果你调用一些外部code,像windows的API,只要每个人都是一样的页面与他们的期望上。

You can mix calling conventions, say if you're calling some external code, like windows APIs, as long as everyone is on the same "page" with their expectations.

典型的C调用都是使用了所谓的CDECL编译。在CDECL调用者清理参数压入堆栈。

Typical c calls are compiled using what's known as cdecl. In cdecl the caller cleans up the arguments pushed on the stack.

WINAPI,也被称为标准呼叫是指该被调用函数是负责清理它的参数的堆栈。

WINAPI, also known as "standard call" means that the called function is responsible for cleaning up the stack of its arguments.

在MS编译器将preFIX有一个CDECL调用_,而​​WINAPI获得一个领先_,并得到一个@ {BYTES急需} prepended当它轧液的功能名称的功能名称。从上面的链接:

The MS compiler will prefix a cdecl call with a _, while a WINAPI gets a leading _ and gets an @{BYTES-NEEDED} prepended to the function name when it mangles the function names. From the link above:

call        _sumExample@8  ;WINAPI
call        _someExample   ;cdecl

这篇关于是什么WINAPI代表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆