Function pointer and calling convention

前端 未结 3 1921
栀梦
栀梦 2021-02-04 04:24
float __stdcall (*pFunc)(float a, float b) = (float (__stdcall *)(float,float))0x411280;

How to declare a function pointer with calling convention? The

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-04 04:50

    The trick is placing the __stdcall inside the parentheses like this:

    float (__stdcall *pFunc)(float a, float b) = (float (__stdcall *)(float,float))0x411280;
    

    Of course, you are recommended to use a typedef instead, but the same trick applies:

    typedef float (__stdcall *FuncType)(float a, float b);
    

提交回复
热议问题