Is there a 64bit alignment requirement for request data structures?

Geez! It was really the packing of the struct that was the problem here.

For the record, I am using the g++ compiler (which comes “out of the box” with the open source Qt framework, also on Windows), and the corresponding compiler instruction is (in C++) attribute ((packed)), as in:

struct MyStruct {
  // members of various byte sizes
  ...
} __attribute__ ((packed));

(I have yet to figure out and add the proper preprocessor macros, to distinguish between g++ and an msvc, in case the code gets compiled with an MS compiler, also refer to the “pack pragma” above).

A test debug statement confirmed that the “packed” struct is 4 bytes less in size (int32 vs int64) than the memory-aligned one, as expected. And with this also the write requests worked as expected (why the read requests actually resulted in the expected data is still beyond me - pure luck?).

I hope this is of help to anyone else stumbling over the same issue:


→ control the memory alignment (packing) of your structs! (with the corresponding compiler-specific instructions)


UPDATE:

Never mind preprocessor macros: it is probably simply enough to add both (all relevant) compiler-specific instructions, for g++ and MSVC, as e.g. in:

#pragma pack(push, 1)
struct MyStruct {
  // members of various byte sizes
  ...
} __attribute__ ((packed));
#pragma pack(pop)

At least the g++ compiler does not care about the MSVC specific #pragma instruction (in fact, it may even “understand” it, haven’t tried that yet), and I’d expect the MSVC to do the same with the g++ specific __ attribute __ instruction.

Other compilers are not relevant here (for me), because in the end this code compiles on Windows only anyway (SimConnect is Windows only, of course ;))