Skip to content

Conversation

graalvmbot
Copy link
Collaborator

All methods from a native library need to be in the same layer, as the native library can keep track of a state in C variables. Since the native library is linked statically against each layer, the state is kept in a separate space for each layer. This means that if two methods access the same variable, but are in different layer, they will access two different instances.

In the future, the libraries might be dynamically linked, meaning the same space will be used in all layers, but for now, this is the only solution.

To do that, all native methods are included in the layer they are first seen in.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 17, 2025
@graalvmbot graalvmbot force-pushed the scoppey/GR-70014/make-native-libraries-layer-aware branch from 0450109 to 6f2dbec Compare October 20, 2025 11:49
@graalvmbot graalvmbot merged commit a5bace1 into master Oct 20, 2025
13 checks passed
@graalvmbot graalvmbot deleted the scoppey/GR-70014/make-native-libraries-layer-aware branch October 20, 2025 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants