Dephi调用C++的DLL问题?怎么定义?(50分)

Type RSI_ID=string[5];
end;

var
id:RSI_ID;
p:pchar;
str_id:String;
begin
p:=pchar(id)
SetLength(str_id, 100); //PChar一定要先分配内存
Result:= rsiIDToText(p,PChar(str_id));
end;

 
不行...
Function rsiIDToText(ID:RSI_ID;text:pchar):integer;stdcall; external 'rsidll32.dll';
text:pchar)://text是不是用PChar?
我想rsiIDToText这个函数定义也可能不是这样...
 
总是这样:
Access violation at address 10039E9 in module 'rsidll21.dll' Read of address 99817489
 
===Delphi================================================================
Type RSI_ID1=record
b0 : Byte;
b1 : Byte;
b2 : Byte;
b3 : Byte;
b4 : Byte;
end;
PRSI_ID = ^RSI_ID;
Function rsiIDToText(ID:pRSI_ID;text:pchar) :RSI_DATA_ERROR; stdcall; external 'rsidll32.dll';
Function rsiTextToID(text:pchar;ID:pRSI_ID) :RSI_DATA_ERROR; stdcall; external 'rsidll32.dll';

在 C++中的定义RSI_ID是一个数组,所以作为参数传递时应该采用指针
 
接受答案了.
 
顶部