How do you declare an extern “C” function pointer

后端 未结 2 1312
青春惊慌失措
青春惊慌失措 2021-02-20 03:51

So I have this code:

#include \"boost_bind.h\"
#include 
#include 
#include 

double foo(double num, double (*func)(         


        
2条回答
  •  面向向阳花
    2021-02-20 04:21

    Try using a typedef:

    extern "C" {
      typedef double (*CDoubleFunc)(double);
    }
    
    double foo(double num, CDoubleFunc func) {
      return 65.4;
    }
    

提交回复
热议问题