Wessel van der Linden
Wessel van der Linden

Reputation: 2622

Instances of shared library on android

There is a shared library with static variables and functions I want to use in both Flex and Java. So my Flex application loads the library through an ANE file, the Java through JNI (though it is the exact same library). Does Android load 2 instances of the library for each application or does it use the same instance for every app using it?

For example: The library has a static integer variable that is assigned to 0 when created. Flex changed that integer to a 3. What result will Java give if the Java code reads that variable. A 0 or the 3?

Upvotes: 0

Views: 303

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006539

So technically they are two different applications

If they are two different applications (e.g., would have two separate entries in the Play Store), then they will run in separate processes. Each app will have a copy of the JNI code; each process will load its own copy of that JNI code. Nothing will be shared between them, any more than if the two applications were installed on separate devices.

Upvotes: 1

Related Questions