一段代码
   if not FileExists(ExtractFilePath(Application.ExeName)+'demo.dll') then
    raise Exception.CreateFmt('Can not find file %s', ['demo.dll']);  LibHandle := LoadLibrary(PChar('demo.dll'));
  if LibHandle = 0 then
    raise Exception.CreateFmt('%s 文件加载出错', ['demo.dll']);
  try
    @GetSIMICCID := GetProcAddress(LibHandle, 'GetSIMICCID');
    if @GetSIMICCID = Nil then
      raise Exception.CreateFmt('在 %s 中找不到程序 %s', ['demo.dll','GetSIMICCID']);
    Result:=GetSIMICCID(sim);
  finally
    FreeLibrary(LibHandle);
  end;
客户老是报"'demo.dll'文件加载出错"
而我的机器又不会
很奇怪呀

解决方案 »

  1.   

    你的demo.dll是不是需要用到其他的DLL啊?比如说你在DLL中需要传递字符串参数的话,
    就需要DELPHI的一个系统DLL,你的机器上装了DELPHI,所以用起来没有问题,
    客户的机器上没有,所以就不行了。
      

  2.   

    LibHandle := LoadLibrary(PChar(ExtractFilePath(Application.ExeName)+'demo.dll'));
    可能是路径的问题
      

  3.   

    可以通过GetLastError来获得错误原因
      

  4.   

    可能你调用的Dll与其它文件相关联,若是把它们放在一起再试