c++ - C 中的 typedef、DLLEXPORT、__stdcall 帮助

标签 c++ c

谁能告诉我以下两行代码的完整含义?

typedef void DLLEXPORT __stdcall (*DLL_Inquiry) (char *cDriverName, int *iDriverType, int *iDriverBUS, int *iNumberOfChannel);

DLL_Inquiry DRV_PH_Inquiry;

我知道 DLLEXPORT 是从 DLL 导出函数,__stdcallx86 参数传递约定。

但我仍然无法理解这两行的全部含义。可能是我对 typedef 中函数或函数指针的使用感到困惑。

最佳答案

DLL_Incuiry 是一个指向函数指针的类型定义,它接受参数 (char*, int*, int*, int*) 并且不返回任何值(返回类型 无效)。该函数还使用 DLLEXPORT 和 __stdcall 定义的调用约定。

DRV_PH_Inquiry 是该类型的变量,因此如果您有函数 foo:

void DLLEXPORT __stdcall foo (char *cDriverName, int *iDriverType, int *iDriverBUS, int *iNumberOfChannel);

然后你就可以做作业了:

DRV_PH_Inquiry = foo;   // DRV_PH_Inquiry now points to the function foo

关于c++ - C 中的 typedef、DLLEXPORT、__stdcall 帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22909726/

相关文章:

创建文件,使用 lseek() 移动 1MB,然后将一个字节写入文件

c - 没有从开关盒中出来

c++ - 如何检查套接字是否已连接

c++ - cin.fail具有额外条件C++

c - 返回字符串数组

C winsock "rolling parsing"

c++ - 写入SD卡arduino

c++ - 如何从通过 Windows MiniDump 调用生成的核心转储中获取堆栈跟踪?

C++:code::block 无法识别包含的 header

c++ - 体系结构 x86_64 的 undefined symbol : Xcode 5 Issues