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
c2hs fails to produce the correct alignment #272
Comments
This is happening because currently |
@deech If you have an idea of how to do it maybe I can take a shot at it? |
Yes absolutely, the addition would start where we calculate struct and struct field alignments and sizes and affect calculations downstream of that. The GNU specific The other option is we simply don't support alignment attributes in c2hs and actually error in their presence although I would suspect this would break a bunch of code in the wild. |
Yet another option is to generate a C file that includes the header and print the values we need using the builtin |
@Kleidukos Are you still interested in working on this issue? I'm happy to help you with it. |
@deech I would love some help on that one. :) |
Cool! Send an email to the last maintainer address listed on the Hackage page and we can set up a time to jump on a call and we can talk through options. |
I started a small repo to capture and run alignment and sizeof test cases, feel free to fork it and add more. Once the feature is complete we can port them back to this repo. |
@kozross ☝️ |
Bump |
@deech @Kleidukos and I are looking at the example and working out a way forward: thanks for that! |
@Kleidukos @kozross Are you still planning on working this issue? Is there anything I can do to help? |
@deech We had to pause a bit this last month but I'd like to work on it again. :) We'll ping you it ever is blocked by something big. In the meantime if someone submits a PR with a fix, don't wait for us! |
@deech Coming back to say that it is going to be quite hard for me to bring this to completion. If you ever feel like fixing it, do feel free. :) Thank you for your support in any case! |
I am producing bindings for
libsodium
, and especially the following struct:Here is my Types.chs file:
Types.chs
And here is the generated Haskell code
Types.hs
As you can see, the alignment in the
Storable
instance is1
instead of64
. Could this be caused by the use of a macro or is this a red herring?The text was updated successfully, but these errors were encountered: