Comments (14)
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.
from c2hs.
This is happening because currently c2hs
ignores all aligned
(and packed
) GNU specific attributes. In this particular case 1
is accidentally correct because 384 is a multiple of 64 and so the field will naturally align at a 64 bit boundary. I'm not sure when I'll have time to add support for them.
from c2hs.
@deech If you have an idea of how to do it maybe I can take a shot at it?
from c2hs.
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 packed
and aligned
attributes are passed along in a CAttr, you can read more about them in the GCC manual. I can even walk you through the code that currently exists if you like. Brace yourself, this is a relatively involved change. 😄
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.
from c2hs.
Yet another option is to generate a C file that includes the header and print the values we need using the builtin sizeof
, alignof
and offsetof
. We do this currently to get the size of a bool. Honestly if we can reliably generate the file this might be the best approach.
from c2hs.
@Kleidukos Are you still interested in working on this issue? I'm happy to help you with it.
from c2hs.
@deech I would love some help on that one. :)
from c2hs.
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.
from c2hs.
@kozross ☝️
from c2hs.
Bump
from c2hs.
@deech @Kleidukos and I are looking at the example and working out a way forward: thanks for that!
from c2hs.
@Kleidukos @kozross Are you still planning on working this issue? Is there anything I can do to help?
from c2hs.
@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!
from c2hs.
@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!
from c2hs.
Related Issues (20)
- Darwin: The symbol `_9' does not fit here. HOT 1
- Hackage version of c2hs fails to build with GHC-8.8.4 or 8.10.2 HOT 6
- pseudo block c and enum, creates wrong line counting
- Release schedule HOT 1
- Loosen bounds on language-c HOT 1
- Lexical error ! The character '#' does not fit here HOT 8
- Hackage tarball lacks tests
- Placeholder: removing `/=` from `Eq` HOT 2
- Haddock comments on enum constructors
- One more error with macos and time.h HOT 2
- capi calling convention
- Fails on Darwin with "clang: error: no input files"
- Paper Link Broken HOT 1
- _Bool type is broken
- Release a version where `cabal test` succeeds
- The symbol `[' does not fit here.
- "The symbol _Alignas does not fit here" when compiling with nvidia cuda.
- c2hs confused by clang headers on the Windows platform HOT 5
- Linker error with sublibraries and `__c2hs__wrapped__`-functions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from c2hs.