函数指针和调用约定 [英] Function pointer and calling convention
本文介绍了函数指针和调用约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
float __stdcall (*pFunc)(float a, float b) = (float (__stdcall *)(float,float))0x411280;
如何声明与调用约定的函数指针?以上给我一个错误。
How to declare a function pointer with calling convention? The above gives me an error.
推荐答案
诀窍是放置__stdcall这样的括号内:
The trick is placing the __stdcall inside the parentheses like this:
float (__stdcall *pFunc)(float a, float b) = (float (__stdcall *)(float,float))0x411280;
当然,建议您使用typedef代替,但同样的招数适用:
Of course, you are recommended to use a typedef instead, but the same trick applies:
typedef float (__stdcall *FuncType)(float a, float b);
这篇关于函数指针和调用约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文