本帖最后由 zengting 于 2011-10-11 23:19:45 编辑

解决方案 »

  1.   

    声明并定义回调函数, 然后传递给Export
      

  2.   


    // CallBack.cpp : 定义控制台应用程序的入口点。
    //#include "stdafx.h"
    #include "..\Dll\Dll.h"#pragma comment(lib, "..\\Debug\\Dll.lib")__declspec(dllimport) int WINAPI Larger(int a, int b, COMPARE Compare);int CALLBACK Compare(int a, int b)
    {
    return a > b ? a : b;
    }int _tmain(int argc, _TCHAR* argv[])
    {
    return Larger(10, 20, Compare);
    //return 0;
    }//以下为DLL//Dll.h
    #include "stdafx.h"
    typedef int (CALLBACK *COMPARE)(int a, int b);// Dll.cpp : 定义 DLL 应用程序的导出函数。
    //#include "stdafx.h"
    #include "Dll.h"__declspec(dllexport) int WINAPI Larger(int a, int b, COMPARE Compare)
    {
      return (*Compare)(a,b);
    }
    类似以上的
      

  3.   

    工程属性,linker -- input -- additional dependencies 添加你的lib了没?
      

  4.   

    CallBack pfun
    这个函数原型