struct length is different on due vs mega

i have the following struct

String cmd;
String load;


(byte*)&txdata - returns 12 on mega and 24 on due, why ? How i can fix ?

Thanks in advance.

? How i can fix ?

Define "fix"

Why would you want to?


32 vs. 16 bit ints.

In a case you can fix you need to use data types that are the same length. But even then it is not a good idea to share structs because of padding and endianness.

In this case, it is hopeless since Strings are pointers and the data you want isn't even in the struct. You need to use fixed length nul-terminated C strings.

I understand that i can't use strings.
Tried with char works perfectly.

Thank you!