typedef int (getint)(CString str);HINSTANCE hInstance;
    getint* func=NULL;    int i;   
    CString chf; VERIFY(hInstance=::LoadLibrary("d:\\temp\\Project1.dll"));
    VERIFY(func=(getint*)::GetProcAddress(hInstance,"GetInt"));
if(func==NULL)
MessageBox("get faill!");
    
    i=(*func)("34");以上调用出错!麻烦指教!

解决方案 »

  1.   

    你在dll中定义GetInt方法的时候有没有在他的前面加上extern "C",或者在def文件中指定输出的符号为"GetInt"?
    如果没有得话,你导出的函数已经被改名了,你当然得不到他的指针了。
      

  2.   

    是编译出错还是运行时出错?
    要注意dll的调用规范和你当前进程的调用规范一致
      

  3.   

    谢谢诸位!
    问题出在
       typedef int (__stdcall getint)(CString str);
    加上"__stdcall"就可以了,这个动态库y用delphi做的。