Home > Back-end >  Delphi structure, the problem of serialization
Delphi structure, the problem of serialization

Time:11-14

This is a c # code, including cw_face_res_t structure, m_buffVerify is pointer
Cw_face_res_t faceRect=new cw_face_res_t ();
FaceRect=(cw_face_res_t) Marshal. PtrToStructure (m_buffVerify, typeof (cw_face_res_t));
Consult everybody warrior with Delphi how reality

CodePudding user response:

You want to advance a statement this structure,
Struct in C, C + +, C # corresponding record of Delphi

CodePudding user response:

Structure has stated in Delphi, c # the PtrToStructure method means that the data from an unmanaged memory blocks to specify the types of managed objects, new distribution Delphi don't know how to turn around, need to use the pointer variable m_buffVerify

CodePudding user response:

 
Type
PMyData=https://bbs.csdn.net/topics/^ TMyData;
TMyData=https://bbs.csdn.net/topics/record
A: char;
B: a byte;
C: integer;
end;

Procedure TForm1. Button1Click (Sender: TObject);
Var
P: Pointer;
R1: TMyData;
The begin
R1. A:='a';
R1. B:=1;
R1. C:=2;
GetMem (p, sizeof (TMyData));
Move (r1, p ^, sizeof (TMyData));//copies structure to pointer
Showmessage (PMyData (p) ^. A);
Showmessage (IntToStr (PMyData (p) ^. B));
Showmessage (IntToStr (PMyData (p). ^ c));
FreeMem (p);
end;

CodePudding user response:

Direct faceRect:=m_buffVerify ^; Can
  • Related