-
Notifications
You must be signed in to change notification settings - Fork 76
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
Alignment problem with libdespotify #1
Comments
Thanks for the sample, I'll add it to the test cases. I think you are actually hitting a bug with the way that |
Fixes the failing tests and #1 :)
Fixed by @tjfontaine in da85dac :) |
I'm amazed at how fast the open source community works. |
Hi there,
I am currently trying to interface libdespotify (see despotify.se) with node / ffi. Libdespotify makes heavy use of structs to store information about artists, albums and tracks.
However, the data in the struct is not aligned to four bits as ref-struct seems to assume. The fields of the structs mostly appear directly after each other, but sometimes there are 2 or 3 bytes of nothingness inbetween. I do not know C very well and have not yet been able to figure out why this happens.
I have gotten it to work by patching ref-struct to always set the alignment to zero and and inserting the random padding bytes manually after figuring out where they have to be by trial and error.
Setting alignment to zero in struct.js:
Struct definition in libdespotify:
Working implementation in node.js:
Is this a bug in ref-struct or am I just doing something wrong?
Greetings,
antidau
The text was updated successfully, but these errors were encountered: