现有一个接口说明:
函数名:getcompinfo
入口参数:无。
出口参数:字符串。
格    式:getcompinfo(szOut)
函数返回值:0,正确;非0整数,错误码。
 出口参数说明:
序号 数据项 类型 长度 说明
1 编号 C 20
2 名称 C 200 我用delphi写的代码:
function getcompinfo(var szout:pchar):integer;stdcall;external 'abc.dll'
procedure aaa();
var
  str : pchar; i:integer;
begin
  if getcompinfo(str) = 0 then
   showmessage(str);
end;跟踪得到的结果:str:Inaccessible value 
看起来是内存不足,请帮忙看看如何解决。谢谢。

解决方案 »

  1.   

    出口参数说明:
    序号 数据项 类型 长度 说明
    1 编号 C 20 
    2 名称 C 200 
    需要分配220的空间,你就声明了一个str:Pchar,没有分配空间
      

  2.   

    procedure aaa();
    var
      str : pchar; i:integer;
    begin
      Getmem(str,220);
      if getcompinfo(str) = 0 then
      showmessage(str);
    end;这样写也还是一样啊
      

  3.   

    那就试试这样是否可以
    function getcompinfo(out szout: WideString): integer;stdcall;external 'abc.dll'
    procedure aaa();
    var
      str: WideString;
    begin
      if getcompinfo(str) = 0 then
      showmessage(str);
    end;
      

  4.   

    你确认是c#?
    那个东西需要.net的,再有,他可能是activex dll,非标准dll