Lifecycle supports 32-bit architectures #977
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
I'm using Neon to write a Node.js native module that will be run in nodejs-mobile, on mobile architectures such as armeabi-v7a (32 bit), aarch64 and so forth.
Problem
With
neon
0.10.1:Cross-compilation for Android armv7 (32-bit) fails because AtomicU64 is not supported for that architecture. This is assuming that neon's
napi-6
feature is enabled, because ofneon/crates/neon/src/sys/mod.rs
Lines 34 to 35 in fe4642e
and
neon/crates/neon/src/lifecycle.rs
Line 15 in fe4642e
If I use
napi-5
feature, compilation succeeds.Solution
This PR enables
napi-6
to support 32-bit architectures, by using AtomicU32 instead. Arguably, we lose a lot more identifiers forInstanceId
, but U32 gives us 4 billion identifiers, and maybe this is sufficient?A follow-up to this PR would switch the
AtomicU*
type depending on the architecture.