别人给我一个dll,我想增加一个导出函数。//interface.h
int WINAPI RecordClose();
int WINAPI ReadFile();// 增加的函数
//interface.cppint WINAPI RecordClose()
{
  return 1;
}int WINAPI ReadFile()// 增加的函数
{
return 1;
}
我已经增加了这两个地方,原来的函数RecordClose()可以用,而我新增加的ReadFile却不行为何?错误为:SelLanguageDlg.obj : error LNK2001: unresolved external symbol "int __stdcall ReadFile(void)" (?ReadFile@@YGHXZ)
Debug/Command.exe : fatal error LNK1120: 1 unresolved externals

解决方案 »

  1.   

    export DLL 中的一个函数有两种方法:
    1。用.DEF 文件: 在你的程序目录下找到 .def 文件,把ReadFile加进去。
    2。用__declspec: 在你的.h 文件加
    #ifdef W32DLL_EXPORTS
    #define W32DLL_API __declspec(dllexport)
    #else
    #define W32DLL_API __declspec(dllimport)
    #endifW32DLL_API int ReadFile();你的程序好像是用的第一种。
      

  2.   

    在你目录的.def 文件中LIBRARY      "EMIS_DRAWA.OCX"EXPORTS
             RecordClose         @1
             ReadFile            @2