隐士调用
函数定义为:
extern "C"  __declspec(dllimport) int  Startup(char* LocalIp,,void (* fProcessDeliver)(DeliverStr deliver));
DeliverStr为一已定义结构
void CMyDlg::PDeliver(DeliverStr deliver) //定义
{  ...
}
调用时
int res = Startup("10.10.10.10", ,PDeliver);
其他的地方没错 只一处PDeliver有问题
cannot convert parameter 14 from 'void (struct deliverstr)' to 'void (__cdecl *)(struct deliverstr)'None of the functions with this name in scope match the target type
不知何故? 哪位大侠帮忙看看

解决方案 »

  1.   

    你这样是不可以的。你的动态库中只能传入静态函数指针,不能传入类的函数指针.试想一下,如果你的程序中有两个CMyDlg对象,你传入的是哪一个?其实你这种情况,编译器根本无法定位你的要传入的函数指针地址。
      

  2.   

    我的程序是基于对话框的 CMyDlg只会有一个对象实例
      

  3.   

    你的PDeliver函数必须声明为static!因为只有全局函数才能作为指针!!
      

  4.   

    如何加 static写在哪? 大侠说详细些撒  这就结贴了