I am a C # developer, I am writing a client for a server written in C ++. The server transmits some data over TCP / IP to the client, and we must collect it at the other end. The server sends us first a description of the data, then the data itself.
Problem structure:
struct Inner_S { double a; double b[4][4]; }; #pragma pack(1) struct Packed_S { uint8_t c; Inner_S d; };
The server tells the client that the external structure has alignment 1 and the internal structure has alignment 8. The protocol specification says:
Field matching in the stream structure is performed in accordance with the 64-bit specification of the Itanium application's C ++ binary interface interface (i.e., similar to the typical GNU compiler on a typical 64-bit platform).
I found the specification of the binary interface of an application based on a 64-bit C ++ processor . I think the part I'm looking for is "Distribution of members other than virtual databases", but I'm lost there.
On the C # side, I read the data stream and pack my own class with the values ββextracted from the structure. I need to know exactly where in the stream to look for each element of the structure.
I am currently processing the structure in a way that does not match my users:
(start structure with alignment 1) (no need to fill) (read simple value) c (start internal structure with alignment 8) (add padding to alignment 8) 0000000 (read field) aaaaaaaa (start of array) (read simple value) BBBBBBBB .....
This method is supported by at least one site.
So, when I parse this data, how do I handle alignment in Inner_S ?
caaaaaaaabbbbbbbbb .... (i think?) caaaaaaaa0000000bbbbbbbbb .... (looks wrong)
source share