C++中的原型声明:
调用语法:
int InitHandle (char * OutPutData)
参数描述:
char * OutPutData  传回初始化信息
返回值:成功,返回0,失败,返回-1。
Delphi里面应该怎么传参数进去呢?我用的下面的方法,可是当Showmessage的时候,总是报异常错误。正确的方法应该怎么调?谢谢大家!
unit Main_Unit;interfaceuses
  ShareMem, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, StrUtils, JNI, filectrl;const
  LibraryFile = 'SiInterface.Dll';function Delphi_InitHandle: PChar; function InitHandle(InPutData: PChar): integer; StdCall; External LibraryFile;implementationuses pub_Unit;function Delphi_InitHandle: PChar;
var
  S:PChar ;
  i: integer;
  resultS: string;
begin
  resultS := '';
  try
    i := InitHandle(S);
    resultS := String(S);
    Showmessage(resultS);
    Result := PChar(resultS);
  except
    on e: exception do
      ShowMess(e.Message);
  end;
end;end.