Skip to content

Conversation

@tannergooding
Copy link
Member

This resolves #233

ClangSharpPInvokeGenerator was attempting to be "smart" by calculating the alignment itself, but this is potentially problematic for scenarios that differ between 32-bit and 64-bit as the Clang AST will only expose one.

This updates the generator to check for and use the attribute added to records that are under a #pragma pack directive and rely on that if it exists. This avoids issues like in #233 that were arising when a struct contained pointer types and was #pragma pack 4 (which meant "expected packing matches specified packing", when in actuality it differed for 64-bit targets).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Packing not emitted for some structs

1 participant