问一个调用VC下编写的dll的问题???好怪哦 Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiBase/html/delphi_20061220075845111.html
接口函数定义:  
  extern   "C"   DllExport   int   PCFileCopyToOther(char   Disk,    
  LPCSTR   PCFileName,    
  LPCSTR   OtherFileName,  
  BOOL   IsDispProgress,  
  LPCSTR   Message)  
  我在delphi引入如下:  
      function   PCFileCopyToOther(Disk:Byte;PCFileName:PChar;OtherFileName:PChar;  
          IsDispProgress:Boolean;mess:PChar):Integer;stdcall;  
  function   PCFileCopyToDev;external   f3200_dll   name   'PCFileCopyToOther';  
  调用时我是这么调用的:  
  PCFileCopyToOther(0,PChar('1.txt'),PChar('2.txt'),True,PChar('请稍后...'));  
  当运行时在XP系统下就很少出错误,但到了2003   server系统下运行时就出现“内存不能read的错误”;当我将PChar改成shortstring时虽然不出错了,但是传参数时的值可能就不对了,每次调用都得不到预期的值。  
  LPCSTR应该对应是PChar吧

delphi中stdcall->cdecl

楼上,还是不行啊,XP和2003   server不一样吗

用shortstring倒是没出错,但是该怎么传递参数呢

Debug~~

楼上什么意思?

就是相对于RELEASE

没人知道吗

看来分发不下去了

可能的原因为,函数中要改参数的值,你用常量,就会出错  
  解决方法,用array   [0..xxx]   of   char代替pchar  
  或用pchar,但先申请内存,再赋值,最后再调函数

相关文章:

  • 2021-08-29
  • 2021-12-04
  • 2021-06-14
  • 2021-05-18
  • 2021-06-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案