在dll中定义
int DllExport test ()
{
   MessageBox(NULL,"OneStopFactory is called.","Leadtone",MB_OK);
    return 0;        
}调用时
HINSTANCE hModule;
typedef int (Dllfun)();
FARPROC  hFunction ; hModule = ::LoadLibrary("dllhost.dll");
hFunction = ::GetProcAddress((HMODULE)hModule,"test");
(*hFunction)();
hfunction 总得不到test()的地址。另外,我在使用dumpbin.exe来得到某个DLL中所输出的符号的清单,时出现了这样的问题:出现了对话框“link.exe -无法找到DLL。”

解决方案 »

  1.   

    HINSTANCE hModule=NULL;
    typedef int (*DLLFUN)();
    DLLFUN Dllfun;
    hModule = LoadLibrary("dllhost.dll");
    Dllfun =(DLLFUN)GetProcAddress(hModule,"test");
    Dllfun();
    //试试
      

  2.   

    在动态库工程的def文件中有没有输出test()?
      

  3.   

    把DLL函数定义为:
    extern "C" int DllExport test()
    {
       MessageBox(NULL,"OneStopFactory is called.","Leadtone",MB_OK);
        return 0;        
    }
      

  4.   

    先用depends看看dll的输出函数.
    要注意__stdcall和_ccall.你是在def文件输出函数吗?
    是的话,just like this:
    typedef int (__stdcall *dllfun)();
      

  5.   

    我没有.def文件,必须要该文件么
      

  6.   

    你在LoadLibrary时有没有设路径。
    将绝对路径写上试一试,看hModual对不对
      

  7.   

    #ifdef DllExport __declspec(dllexport)
    #else
    #define DllExport __declspec(dllimport)
    #endif然后定义def文件~
      

  8.   

    你的test ()没有输出吧,如下定义
    extern "C" _declspec(dllexport) int test() 
      

  9.   

    调用时
    HINSTANCE hModule;
          typedef int (Dllfun)();-> 定义错误,typedef int (*DLLFUN)();
    FARPROC  hFunction ; hModule = ::LoadLibrary("dllhost.dll");
    hFunction = ::GetProcAddress((HMODULE)hModule,"test");
              //Dllfun=(DLLFUN)xxxxxx (*hFunction)();
             //(*Dllfun)();  
    hfunction 总得不到test()的地址。