You are not logged in.
Pages: 1
I'm trying to migrate my code from Delphi to Free Pascal and I'm facing the chalange of make the CopyRecord metod from System in Delphi to Free Pascal.
I have the const pSolicitacao: TDTOSolicitacao and the var vSolicitacao: TDTOSolicitacao;
In my code I have to copy pSolicitacao to vSolicitacao because my function GetPosto is gonna change values from the record:
function TSolicitacaoService.Add(const pSolicitacao: TDTOSolicitacao): TServiceCustomAnswer;
var
vSolicitacao: TDTOSolicitacao;
begin
CopyRecord(@vSolicitacao, @pSolicitacao, TypeInfo(TDTOSolicitacao));
if not GetPosto(vSolicitacao) then
begin
Result := ReturnRecordNotFound('Posto não encontrado.');
Exit;
end;
etc...
end;
Anyone to help me with this migration?
Offline
You can use RecordCopy() from mormot.core.rtti for this purpose, without any @ pointer:
RecordCopy(vSolicitacao, pSolicitacao, TypeInfo(TDTOSolicitacao));
Generally, you have in mORMot everything you need for cross-compiler code.
Offline
Tnks AB
Offline
Pages: 1