C/C++中什么时候需要使用__stdcall?

2022-08-13 08:17:47

一、定义

__stdcall 调用约定

Argument-passing order
Right to left.
参数传递顺序从右到左。

Argument-passing convention
By value, unless a pointer or reference type is passed.
按值传递,除非使用指针或者引用。

Stack-maintenance responsibility
Called function pops its own arguments from the stack.
被呼叫的函数负责清理堆栈。

二。什么时候应该使用__stdcall呢?

1.写com组件时最好使用__stdcall声明.
2.DLL最好也使用__stdcall,因为绝大部分的语言都支持__stdcall方式,所以想要其他语言都能使用该DLL的话,就得使用__stdcall的方式.前面说 的com最好也是用__stdcall的方式定义,也是因为希望能支持其他语言的原因.

参考:

https://blog.csdn.net/weixin_44117123/article/details/106324263

  • 作者:物随心转
  • 原文链接:https://blog.csdn.net/sinat_31608641/article/details/108256527
    更新时间:2022-08-13 08:17:47