外部dll如下:Function long getpsw(REF string  pwd,REF string newpsw)  library "psw.dll"在delphi中,如下调用:
  function getpsw(str0,str1: string):longint;stdcall;//cdecl?
  far;external 'psw.dll'name 'getpsw';编译已经没有问题,但是在运行时,出现如下提示:project project1.exe raised exception class EAccessViolation with message 'Access violation at address 1000D9C8' in module 'psw.dll'.write of address 000000'.process stopped.use step or run to continue.求教解决方法。在此先行致谢。

解决方案 »

  1.   

    function getpsw(str0,str1: string):longint;stdcall external 'psw.dll' name 'getpsw';
      

  2.   

    试试这个:
    function getpsw(str0, str1: pchar): Longint; stdcall external 'psw.dll';
      

  3.   

    在dll用export过的过程或函数才能调用的
      

  4.   

    问题已经解决,乃数据传递的缘故。叮当兄切题。
    最终我的声明为:
    function getpsw(str0:tring;str1:pchar):longint;stdcall;//cdecl?
      far;external 'psw.dll'name 'getpsw';(str0的值我是在delphi的窗口传入的,进入dll后,最后生成str1的值。此前str1为string时,数值未有变化(而且奇怪的是,如果我没给str1分配定额内存,就会提示内存的问题),改成pchar数值就能返回。)多谢诸位关注。都给分