近日,我用Delphi写了一些函数,都封装在一dll中。我现想在VC下使用这些函数,但没有lib文件,程序老是链接错误。各位仁兄帮帮忙!!!!

解决方案 »

  1.   

    用 Dynamic-Link Libraries   LoadLibrary 
      GetProcAddress 
      FreeLibrary... 详见MSDN帮助
      

  2.   

    VC下的头文件为:
    #ifndef _SHEN_H#define _SHEN_Hextern "C"{void APIENTRY OpenIniFile(char* FileName);
    void APIENTRY CloseIniFile();
    int APIENTRY ReadInteger(char* Section,char* Ident,int Default);
    double APIENTRY ReadFloat(char* Section,char* Ident,double Default);
    char* APIENTRY ReadString(char* Section,char* Ident,char* Default);
    void APIENTRY WriteInteger(char* Section,char* Ident,int Value);
    void APIENTRY WriteFloat(char* Section,char* Ident,double Value);
    void APIENTRY WriteString(char* Section,char* Ident,char* Value);
    }#endif
     
     不知为什么,出现下列错误:
    qwView.obj : error LNK2001: unresolved external symbol _OpenIniFile@4
    Debug/qw.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
      

  3.   

    改写一下:
    extern "C" __declspec( dllexport )
    {
    ...
    }
      

  4.   

    我试过,还是出现刚才的错误。我想是没有.lib文件,但我不知道用什么tools由dll文件生成lib文件。
      

  5.   

    把#program comment(lib,"xxxx.lib")放在前面试试
      

  6.   

    :) o_racle(璐璐) 
    同意