However, if the ada code encodes the object with 'write, then it creates something about 4 bytes too short, and if I use 'output, it is parsed as starting with family_type 256, which is not a member of the enum. Given
that the gnat documentation for the -xdr flag is literally two lines, I
don't really know where to look for more information on what I'm doing
On 2023-07-04 12:56, magardner2010 wrote:
You never defined the protocol and implemented it in the first place.
You used some code generation tools which, if ever worked, will bite you
in the end.
To summarize the problem. The stream attribute 'Write writes the
constrained object. 'Output adds the constraints. Ada is capable to have variable length records. C cannot do this. In short, it means that XDR's discriminated union can be mapped onto Ada's variant record with no
default discriminant, but it cannot be directly mapped onto C's union. I presume that GNAT implements XDR correctly and the C side does not cope.
Which is one of thousand reasons not to implement a communication
protocol by deriving representation from some language objects. Cutting corners will not help you.
Define the (application level [*]) protocol. Implement it in Ada.
Implement it in C. Done.
* XDR or ASN.1 or whatever are not application level!
|Location:||Huddersfield, West Yorkshire, UK|
|Nodes:||16 (2 / 14)|