I’m trying to build a data only dll with MSVC 2008. There is only one structure in the source file.
I’m building the object file with the following flags (/c /TC), and linking it with (/NODEFAULTLIB /NOENTRY /DLL).
I am seeing an extra 0x18c bytes of 00s added to the end, bringing the total size of the data section to be 0x200. Is this some sort of alignment or packing issue? I am currently using a pragma pack on my structure.
How would I suppress the generation of those extra 00s?
Yes, the size of the sections in the executable image (like .data) must be a power of 2 with 512 as the minimum size. IMAGE_OPTIONAL_HEADER.SectionAlignment value.
Simple workarounds are embedding the structure size as a field in the structure and/or the sizeof operator. Or using the resource compiler and SizeofResource().