我写了一个DLL,要在PB中调用,现在别的返回参数都正确,就是string型参数始终无法正确返回,不知道是不是参数类型错误。由于返回值的数据是从一个WebService中获取的,因此返回的值类型为PWideChar,PB中调用时传入的为String,但是返回后在PB中查看返回值为空。请问是怎么回事?在Delphi中我应该怎么设置字符串参数的类型才能让PB正常调用?谢谢!

解决方案 »

  1.   

    在delphi中写的,在pb中调用,不过返回的是pchar,不知是否有帮助,Function p_str(str:string; n:integer):pchar;
      var s:pchar;
          sp:string;
          si:string;
    begin
      //p_str:='pany';
      si:=inttostr(n);
      sp:=str;// + si;
      //getmem(s,200);
      strpcopy(s,sp);
      p_str:=s;
      //freemem(s);
    end;pb中声明
    Function string p_str(ref string str, int i) library "testdll.dll" 我也在写一个DLL,要在PB中调用,其中用到第三方的com对象,遇到了问题,也在此处发了帖子,请老兄帮忙