Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that the record packing and calling convention are correct regardless of -m32 or -m64 #258

Merged
merged 2 commits into from
Aug 4, 2021

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