I am developing a TCP/IP client that has to deal with a proprietary binary protocol. I was considering using user-defined types to represent the protocol headers, and using CopyMemory to shuffle data to and from the UDT and a byte array. However, it appears that VB6 adds padding bytes to align user-defined types. Is there any way to force VB6 to not pad UDT’s, similar to the #pragma pack directive available in many C/C++ compilers? Perhaps a special switch passed to the compiler?
I am developing a TCP/IP client that has to deal with a proprietary binary
Share
No.
Your best bet is to write the low level code in C or C++ (where you do have
#pragma pack), then expose the interface via COM.