DLL中有个函数 int Show(void)
怎样在test.cpp中声明这个函数呢?

解决方案 »

  1.   

    DLL中有个函数 int Show(void)
    怎样在test.cpp中声明这个函数呢?
    ====================================
    int (*p)(void);       //声明函数指针HMODULE hModule=::LoadLibrary("My.dll");   //加载动态库
    p=(int (*)(void))::GetProcAddress(hModule,"Show");    //获取导出函数地址
    int iRet=p();       //调用
      

  2.   

    typedef BOOL (*Function)(LPCTSTR);
    HINSTANCE hLib;
    hLib = LoadLibrary("vants.dll");
    if(!hLib)
    {
    cout<<"Loading library is failed"<<endl;
    return false;
    }
    Function lpfFunction = NULL;
    lpfFunction = (Function)GetProcAddress(hLib,"Function");
    lpfFunction("www")
      

  3.   

    #pragma comment( lib, "aaa.dll" )
    extern int show();