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

Leave bitness-dependent types alone in FFI stuff #825

Merged
merged 9 commits into from
Feb 21, 2019

Conversation

NiLuJe
Copy link
Member

@NiLuJe NiLuJe commented Feb 20, 2019

ffi-cdecl unfortunately converts them to their native type based on the compiler used, which may lead to hilariously annoying to debug memory corruption issues (c.f., #816 ...) given that we can run both on 32bit (arm) & 64bit (x86_64)....

The posix cdecl tried to handle that by forcing a cdecl_type on 'em, but that doesn't quite work, so, do the same arch-dance as pthread ;).

@NiLuJe
Copy link
Member Author

NiLuJe commented Feb 20, 2019

Note that in most cases, when that applies to a function argument, it's not dramatic... unless it's a pointer, because we'll have to ffi.new it.
But that would crash with a helpful "invalid cast" error.

If, on the other hand, you're allocating a struct with fields using one of those types, that's where hilarity ensues...

@Frenzie Frenzie merged commit 8e55e05 into koreader:master Feb 21, 2019
Frenzie added a commit to Frenzie/koreader that referenced this pull request Feb 21, 2019
* Leave bitness-dependent types alone in FFI stuff koreader/koreader-base#825 @NiLuJe
  Required for koreader#4629.
* A few blitting changes for better BB8 performance koreader/koreader-base#816 @NiLuJe
Frenzie added a commit to koreader/koreader that referenced this pull request Feb 21, 2019
* Leave bitness-dependent types alone in FFI stuff koreader/koreader-base#825 @NiLuJe
  Required for #4629.
* A few blitting changes for better BB8 performance koreader/koreader-base#816 @NiLuJe
mwoz123 pushed a commit to mwoz123/koreader that referenced this pull request Mar 29, 2020
…4631)

* Leave bitness-dependent types alone in FFI stuff koreader/koreader-base#825 @NiLuJe
  Required for koreader#4629.
* A few blitting changes for better BB8 performance koreader/koreader-base#816 @NiLuJe
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.

None yet

2 participants