Tushar
2009-05-12 04:36:09 UTC
Hi.....
I am using JNI to interact my application with the C/C++ based
library.
But i want to know regarding the feasibility of using JNI. I want this
things in details.
I searched a lot for this so i collected some points as:
* You can't access arbitrary functions in arbitrary DLLs. JNI
requires that you write a glue C/C++ layer to do whatever you want to
do natively.
* On Android, your glue layer must contain a JNI_OnLoad function
that explicitly register every method that needs to be made available
to the JVM. The JVM can't simply check the export tables and
intelligently import it.
* Since developers must write a glue layer, you must also compile
and package that glue layer per platform you are targeting. This
design is absurd because platforms can have different CPU
architectures and different Operating Systems, and still support
similar calls in the similar libraries.
***** On Android, you must use System.load and provide a full path
instead of using System.loadLibrary. This is because loadLibrary only
checks /system/lib; it does not search LD_LIBRARY_PATH or your current
working directory. Unfortunately, applications can't write to the /
system/lib directory (without root).
IS ANDROID SUGGEST to use JNI for calling native
libraries.... ?????????
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-platform-/***@public.gmane.org
To unsubscribe from this group, send email to android-platform+unsubscribe-/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en
-~----------~----~----~----~------~----~------~--~---
I am using JNI to interact my application with the C/C++ based
library.
But i want to know regarding the feasibility of using JNI. I want this
things in details.
I searched a lot for this so i collected some points as:
* You can't access arbitrary functions in arbitrary DLLs. JNI
requires that you write a glue C/C++ layer to do whatever you want to
do natively.
* On Android, your glue layer must contain a JNI_OnLoad function
that explicitly register every method that needs to be made available
to the JVM. The JVM can't simply check the export tables and
intelligently import it.
* Since developers must write a glue layer, you must also compile
and package that glue layer per platform you are targeting. This
design is absurd because platforms can have different CPU
architectures and different Operating Systems, and still support
similar calls in the similar libraries.
***** On Android, you must use System.load and provide a full path
instead of using System.loadLibrary. This is because loadLibrary only
checks /system/lib; it does not search LD_LIBRARY_PATH or your current
working directory. Unfortunately, applications can't write to the /
system/lib directory (without root).
IS ANDROID SUGGEST to use JNI for calling native
libraries.... ?????????
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-platform-/***@public.gmane.org
To unsubscribe from this group, send email to android-platform+unsubscribe-/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en
-~----------~----~----~----~------~----~------~--~---