[android-beginners] Re: Invoking shared libraries
Hi there I am trying to invoke a c project in android for that i installed android source code in ubuntu and generated an shared library of my c project using the android source code, Now i have to invoke my shared library inside android SDK and make it to run my c project in that shared library,kindly suggest what to do next. On Jun 16, 9:20 pm, Roman roman.baumgaert...@t-mobile.com wrote: Hi Subram, I would try to spend some time in understand JNI. JNI calls are very costly also if your native code might be pretty fast. If you use JNI in the wrong way you program might run very flaky. Find information about JNI on http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni You have to know that you have to write JAVA and C/C++ code to be able to use JNI functionality. On the Java level you are calling the wrapper methods which you have defined on the native level. The method signature format might be a little bit confusing but the usage is straight forward. Furthermore check out the following Android code which uses JNI /external/webkit/perf You find in the main.cpp how to setup JNI on Java level and in MyJavaVM.cpp how to write some wrapper methods which are calling the native code. Make sure that you do on the native level type checks on whatever you are passing down. Furthermore try to think about garbage collection and we it should take place! -- Roman Baumgaertner Sr. SW Engineer-OSDC ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jun 15, 10:18 pm, subram subram...@gmail.com wrote: Hi There How to write a simple JNI that will print a message in the android screen/do the operation specified in the shared library Thanks in advance Subram On Jun 15, 3:42 pm, arunjith g arunj...@gmail.com wrote: you will have to use JNI methods to invoke a call in shared library what u do is 1. Create a java class includes myfunC() 2. Create a jni header file from this class 3. It will have a jni_blahblah_myfunc call 4. create a c/c++ file giving implementation to this function by calling ur required shared library function On Mon, Jun 15, 2009 at 4:08 PM, subram subram...@gmail.com wrote: Hi there I am having an shared library named librecord.so, i have to invoke this library inside the android project and make it to call by the sdk,if any one came across with thisinvokingkindly suggest me Thanks in advance Subram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Invoking shared libraries
Hi there I am trying to invoke a c project in android for that i installed android source code in ubuntu and generated an shared library of my c project using the android source code, Now i have to invoke my shared library inside android SDK and make it to run my c project in that shared library,kindly suggest what to do next. On Jun 16, 9:20 pm, Roman roman.baumgaert...@t-mobile.com wrote: Hi Subram, I would try to spend some time in understand JNI. JNI calls are very costly also if your native code might be pretty fast. If you use JNI in the wrong way you program might run very flaky. Find information about JNI on http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni You have to know that you have to write JAVA and C/C++ code to be able to use JNI functionality. On the Java level you are calling the wrapper methods which you have defined on the native level. The method signature format might be a little bit confusing but the usage is straight forward. Furthermore check out the following Android code which uses JNI /external/webkit/perf You find in the main.cpp how to setup JNI on Java level and in MyJavaVM.cpp how to write some wrapper methods which are calling the native code. Make sure that you do on the native level type checks on whatever you are passing down. Furthermore try to think about garbage collection and we it should take place! -- Roman Baumgaertner Sr. SW Engineer-OSDC ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jun 15, 10:18 pm, subram subram...@gmail.com wrote: Hi There How to write a simple JNI that will print a message in the android screen/do the operation specified in the shared library Thanks in advance Subram On Jun 15, 3:42 pm, arunjith g arunj...@gmail.com wrote: you will have to use JNI methods to invoke a call in shared library what u do is 1. Create a java class includes myfunC() 2. Create a jni header file from this class 3. It will have a jni_blahblah_myfunc call 4. create a c/c++ file giving implementation to this function by calling ur required shared library function On Mon, Jun 15, 2009 at 4:08 PM, subram subram...@gmail.com wrote: Hi there I am having an shared library named librecord.so, i have to invoke this library inside the android project and make it to call by the sdk,if any one came across with thisinvokingkindly suggest me Thanks in advance Subram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Invoking shared libraries
2009/6/22 subram subram...@gmail.com Hi there I am trying to invoke a c project in android for that i installed android source code in ubuntu and generated an shared library of my c project using the android source code, Now i have to invoke my shared library inside android SDK and make it to run my c project in that shared library,kindly suggest what to do next. Have a javaclass, U need to have a JNI layer in between so that java can call ur c functions. So wrape ur c fiels with a jni layer, build another shared library. use System.loadLibrary(libraryname); to load that, and then in java u can call these methods. On Jun 16, 9:20 pm, Roman roman.baumgaert...@t-mobile.com wrote: Hi Subram, I would try to spend some time in understand JNI. JNI calls are very costly also if your native code might be pretty fast. If you use JNI in the wrong way you program might run very flaky. Find information about JNI on http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni You have to know that you have to write JAVA and C/C++ code to be able to use JNI functionality. On the Java level you are calling the wrapper methods which you have defined on the native level. The method signature format might be a little bit confusing but the usage is straight forward. Furthermore check out the following Android code which uses JNI /external/webkit/perf You find in the main.cpp how to setup JNI on Java level and in MyJavaVM.cpp how to write some wrapper methods which are calling the native code. Make sure that you do on the native level type checks on whatever you are passing down. Furthermore try to think about garbage collection and we it should take place! -- Roman Baumgaertner Sr. SW Engineer-OSDC ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jun 15, 10:18 pm, subram subram...@gmail.com wrote: Hi There How to write a simple JNI that will print a message in the android screen/do the operation specified in the shared library Thanks in advance Subram On Jun 15, 3:42 pm, arunjith g arunj...@gmail.com wrote: you will have to use JNI methods to invoke a call in shared library what u do is 1. Create a java class includes myfunC() 2. Create a jni header file from this class 3. It will have a jni_blahblah_myfunc call 4. create a c/c++ file giving implementation to this function by calling ur required shared library function On Mon, Jun 15, 2009 at 4:08 PM, subram subram...@gmail.com wrote: Hi there I am having an shared library named librecord.so, i have to invoke this library inside the android project and make it to call by the sdk,if any one came across with thisinvokingkindly suggest me Thanks in advance Subram -- Shine bright, (: Naveen Krishna Ch :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Invoking shared libraries
Hi Subram, I would try to spend some time in understand JNI. JNI calls are very costly also if your native code might be pretty fast. If you use JNI in the wrong way you program might run very flaky. Find information about JNI on http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni.html You have to know that you have to write JAVA and C/C++ code to be able to use JNI functionality. On the Java level you are calling the wrapper methods which you have defined on the native level. The method signature format might be a little bit confusing but the usage is straight forward. Furthermore check out the following Android code which uses JNI /external/webkit/perf You find in the main.cpp how to setup JNI on Java level and in MyJavaVM.cpp how to write some wrapper methods which are calling the native code. Make sure that you do on the native level type checks on whatever you are passing down. Furthermore try to think about garbage collection and we it should take place! -- Roman Baumgaertner Sr. SW Engineer-OSDC ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jun 15, 10:18 pm, subram subram...@gmail.com wrote: Hi There How to write a simple JNI that will print a message in the android screen/do the operation specified in the shared library Thanks in advance Subram On Jun 15, 3:42 pm, arunjith g arunj...@gmail.com wrote: you will have to use JNI methods to invoke a call in shared library what u do is 1. Create a java class includes myfunC() 2. Create a jni header file from this class 3. It will have a jni_blahblah_myfunc call 4. create a c/c++ file giving implementation to this function by calling ur required shared library function On Mon, Jun 15, 2009 at 4:08 PM, subram subram...@gmail.com wrote: Hi there I am having an shared library named librecord.so, i have to invoke this library inside the android project and make it to call by the sdk,if any one came across with this invoking kindly suggest me Thanks in advance Subram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Invoking shared libraries
On Jun 16, 9:20 am, Roman roman.baumgaert...@t-mobile.com wrote: Furthermore check out the following Android code which uses JNI /external/webkit/perf http://code.google.com/p/mandelbrot/ is perhaps a gentler introductory example. There are other examples in the samples area. The android-ndk mailing list is better for discussion of native code development. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Invoking shared libraries
you will have to use JNI methods to invoke a call in shared library what u do is 1. Create a java class includes myfunC() 2. Create a jni header file from this class 3. It will have a jni_blahblah_myfunc call 4. create a c/c++ file giving implementation to this function by calling ur required shared library function On Mon, Jun 15, 2009 at 4:08 PM, subram subram...@gmail.com wrote: Hi there I am having an shared library named librecord.so, i have to invoke this library inside the android project and make it to call by the sdk,if any one came across with this invoking kindly suggest me Thanks in advance Subram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Invoking shared libraries
Hi thanks for you reply i don't know java/JNI is there any simple code in that i can modify Or any explanations for the steps above mentioned,how to do each step Thanks Regards Subram On Jun 15, 3:42 pm, arunjith g arunj...@gmail.com wrote: you will have to use JNI methods to invoke a call in shared library what u do is 1. Create a java class includes myfunC() 2. Create a jni header file from this class 3. It will have a jni_blahblah_myfunc call 4. create a c/c++ file giving implementation to this function by calling ur required shared library function On Mon, Jun 15, 2009 at 4:08 PM, subram subram...@gmail.com wrote: Hi there I am having an shared library named librecord.so, i have to invoke this library inside the android project and make it to call by the sdk,if any one came across with this invoking kindly suggest me Thanks in advance Subram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Invoking shared libraries
Hi There How to write a simple JNI that will print a message in the android screen/do the operation specified in the shared library Thanks in advance Subram On Jun 15, 3:42 pm, arunjith g arunj...@gmail.com wrote: you will have to use JNI methods to invoke a call in shared library what u do is 1. Create a java class includes myfunC() 2. Create a jni header file from this class 3. It will have a jni_blahblah_myfunc call 4. create a c/c++ file giving implementation to this function by calling ur required shared library function On Mon, Jun 15, 2009 at 4:08 PM, subram subram...@gmail.com wrote: Hi there I am having an shared library named librecord.so, i have to invoke this library inside the android project and make it to call by the sdk,if any one came across with this invoking kindly suggest me Thanks in advance Subram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---