E2017 Pointer type required using move function in Delphi 7 way

若如初见. 提交于 2019-12-11 19:34:32

问题


I'm trying to port a project from Delphi 7 to the new Delphi XE4 and I'm facing a problem with the move function :

{Create a temp record buffer}
HoldRec := AllocMem(RecordSize);
{Fill the temp record buffer with the current record}
move(ActiveBuffer^, HoldRec^, RecordSize); //Here the E2017 Error

The compiler throw an : [dcc32 Error] E2017 Pointer type required , error when arrive at the move statement ...

Why ? In Delphi 7 it compile without any problem, why Delphi XE4 doesn't compile ?

The declaration section is as follows :

FBuffers: TBufList;
HoldRec : PChar;
FActiveRecord :integer;


function TDataSet.ActiveBuffer: TRecBuf;
begin
  Result := FBuffers[FActiveRecord];
end;

回答1:


In Delphi 7, TRecBuf was a pointer of some type, I'm not sure exactly what. In XE4, it is declared as NativeInt. You'd need to cast it to be a pointer to make your code compile.

move(Pointer(ActiveBuffer)^, HoldRec^, RecordSize); 

I would also point out that HoldRec is now PWideChar in Unicode XE4, but it was PAnsiChar in Delphi 7. I suspect you'll need to deal with that one way or another. Quite possibly you'd need to change the declaration to PAnsiChar, but I cannot say for sure from here.



来源:https://stackoverflow.com/questions/17770751/e2017-pointer-type-required-using-move-function-in-delphi-7-way

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!