I wanted to know, suppose in android if there is an application which has some C/C++ code written in it. When this code is executed, it will require the native c libraries. So how does the DVM communicate with these libraries? Does it use Binder for getting the resources from library? or this part of code is not executed in JVM. If not where is this executed and how? And is there any link between JVM and the native libraries?
Asked
Active
Viewed 691 times
1 Answers
1
What do you mean by communicate? .so is loaded into vm, vm will parse the symbols and bind to java native methods if any. Basically vm does not talk to .so then. The byte code world is like a structured memory inside vm process, native method may read from or write into through jni environment routines which is part of vm.

pinxue
- 1,736
- 12
- 17
-
Thanks, I could get it now. One more thing. JNI is used in JVM right? what is the same thing used for Dalvik VM in android? Also how is it decided which native libraries to load to memory? As far as i know, in DVM core libs are loaded while running a program. – Maximus Dec 15 '11 at 08:30
-
1Dalvik VM implement JNI as well. Java class may call System.loadLibrary(name) to ask vm to load .so. – pinxue Dec 15 '11 at 08:59