[android-developers] Re: STL android
hello Kris, thanks for answering. Well ... in my case it makes sense :-( but i don want to go into functionality details. Fact is that i have a c/c++(STL) application which makes some computations :-( and i need it to communicate in any way with a java-androide aplication which will be the UI: one option is NDK-JNI but if possible, i would like to avoid JNI. I wonder, may i run my c++(STL) appl concurrently with the java UI and communicate both of them in order to change some basic information? .. sockets ... pipes ... other .. without JNI ? any way, a NDK-JNI-c++-STL example will be very welcome, if any one of you guys may share it .. and, by the way, how can i port (easy) C++/STL to java ??? On Jun 16, 1:51 pm, Kristopher Micinski wrote: > What application are you trying to migrate? > > Android is different enough, that you will probably be better off rewriting > the application in the SDK framework. > > The NDK wasn't designed to write whole applications, depending on how large > your app is it might be better to rewrite the whole thing. But perhaps > another solution is to keep what you can, and change what you need. > > In any case, most of the time, dropping a few thousand lines of c++ into a > mobile environment just doesn't make sense (i.e., the environment is > different enough that structuring your app different might really be needed, > and if it's a batch processing app it might not make sense to perform some > of the operations in a mobile environment...) > > Kris > > On Thu, Jun 16, 2011 at 11:55 AM, hectordu...@yahoo.com < > > hectordu...@yahoo.com> wrote: > > hi guys, > > I would like to migrate a c/c++ (linux fedora 14) application to > > android 2.2. > > Because this will be my first migration, i have some questions about > > the procedure: > > > 1. considering it has some STL stuff, i wonder if it will work. I > > specially use vector, set, map and algoritms (set_union, > > set_intersection, set_difference). > > > 2. as i understand i have to write -first- a Java-JNI application > > which declares and interface my c functions and c++ methods. Those > > methods willl be included into one (or many) shared libraries ... is > > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don > > like the ones i've found :-( > > > 3- once ready, i must use the NDK toolset in order to generate the > > android application ... hopefully i will works.. > > > I am worried because the NDK info says to have a "A Minimal set of > > headers for C++ support" ... and i wonder if STL works or not ... > > but, NDK r5 - android - suposse to also hav support for STLport ... > > does any body has the hello-jni file modifyied for STL suppport ? > > > NDK Doc also says that "Applications that use native activities must > > be run on Android 2.3 (API Level 9) or later", but as i understand, i > > will also needs JNI .. may somebody make some comments about it ? > > > finally, may somebody share me a JNI example in order to pass some STL > > functions between java and c++ ? > > > comments are wellcome. > > > regards, thanks in advance > > > hector > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: STL android
kris, what is the java equivalent to stl (c++) ? i agree, if easy, i would prefere to port it :-(...and to avooid JNI... On Jun 16, 2:28 pm, Kristopher Micinski wrote: > Unfortunately if you're doing heavy computing, it might *not* make sense. > This is typically the quickest way to kill the battery, and your > application probably is not structured to fit the android specifics. (For > example, what happens if your app is killed after running for a while? This > doesn't happen in linux, but certainly happens on Android.) > > You'll have to use the NDK-JNI if you want to keep any of your c++ code. > How much do you have? Rough estimate? > > You don't have access to the "old world" unix IPC, mostly because of > restrictions imposed for security reasons. > > Difficulty of porting c++/stl to Java should be minimal. It will take time, > but the languages are fairly similar. The thing that will really take time > is restructuring your application to work within the Android process model, > which might require a methodology change depending on your apps structure. > I'm trusting that if your code is complex enough you won't give away what > it does, then you shouldn't have any trouble learning to port it :o)... > > Kris > > On Thu, Jun 16, 2011 at 3:17 PM, hectordu...@yahoo.com < > > hectordu...@yahoo.com> wrote: > > hello Kris, thanks for answering. > > Well ... in my case it makes sense :-( but i don want to go into > > functionality details. Fact is that i have a c/c++(STL) application > > which makes some computations :-( and i need it to communicate in any > > way with a java-androide aplication which will be the UI: one option > > is NDK-JNI but if possible, i would like to avoid JNI. I wonder, may i > > run my c++(STL) appl concurrently with the java UI and communicate > > both of them in order to change some basic information? .. sockets ... > > pipes ... other .. without JNI ? > > > any way, a NDK-JNI-c++-STL example will be very welcome, if any one of > > you guys may share it .. > > > and, by the way, how can i port (easy) C++/STL to java ??? > > > On Jun 16, 1:51 pm, Kristopher Micinski > > wrote: > > > What application are you trying to migrate? > > > > Android is different enough, that you will probably be better off > > rewriting > > > the application in the SDK framework. > > > > The NDK wasn't designed to write whole applications, depending on how > > large > > > your app is it might be better to rewrite the whole thing. But perhaps > > > another solution is to keep what you can, and change what you need. > > > > In any case, most of the time, dropping a few thousand lines of c++ into > > a > > > mobile environment just doesn't make sense (i.e., the environment is > > > different enough that structuring your app different might really be > > needed, > > > and if it's a batch processing app it might not make sense to perform > > some > > > of the operations in a mobile environment...) > > > > Kris > > > > On Thu, Jun 16, 2011 at 11:55 AM, hectordu...@yahoo.com < > > > > hectordu...@yahoo.com> wrote: > > > > hi guys, > > > > I would like to migrate a c/c++ (linux fedora 14) application to > > > > android 2.2. > > > > Because this will be my first migration, i have some questions about > > > > the procedure: > > > > > 1. considering it has some STL stuff, i wonder if it will work. I > > > > specially use vector, set, map and algoritms (set_union, > > > > set_intersection, set_difference). > > > > > 2. as i understand i have to write -first- a Java-JNI application > > > > which declares and interface my c functions and c++ methods. Those > > > > methods willl be included into one (or many) shared libraries ... is > > > > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don > > > > like the ones i've found :-( > > > > > 3- once ready, i must use the NDK toolset in order to generate the > > > > android application ... hopefully i will works.. > > > > > I am worried because the NDK info says to have a "A Minimal set of > > > > headers for C++ support" ... and i wonder if STL works or not ... > > > > but, NDK r5 - android - suposse to also hav support for STLport ... > > > > does any body has the hello-jni file modifyied for STL suppport ? > > > > > NDK Doc also says that "Applications that use native activities must > > > > be run on Android 2.3 (API Level 9) or later", but as i understand, i > > > > will also needs JNI .. may somebody make some comments about it ? > > > > > finally, may somebody share me a JNI example in order to pass some STL > > > > functions between java and c++ ? > > > > > comments are wellcome. > > > > > regards, thanks in advance > > > > > hector > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "Android Developers" group. > > > > To post to this group, send email to > > android-developers@googlegroups.com > > > > To unsubscribe from this group, send email to > > > > android-developers+unsubscr..
[android-developers] Re: STL android
Hi, I have a big "lump" of STL code that is building sucessfully using the latest release of the Android-ndk (r5c). It just need a few tweaks. It is called from Java via JNI as needed. I sugguest you download the NDK: http://developer.android.com/sdk/ndk/index.html and read the docs specifically "CPLUSPLUS-SUPPORT.html" If you have any questions I will try and help. On Jun 16, 4:55 pm, "hectordu...@yahoo.com" wrote: > hi guys, > I would like to migrate a c/c++ (linux fedora 14) application to > android 2.2. > Because this will be my first migration, i have some questions about > the procedure: > > 1. considering it has some STL stuff, i wonder if it will work. I > specially use vector, set, map and algoritms (set_union, > set_intersection, set_difference). > > 2. as i understand i have to write -first- a Java-JNI application > which declares and interface my c functions and c++ methods. Those > methods willl be included into one (or many) shared libraries ... is > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don > like the ones i've found :-( > > 3- once ready, i must use the NDK toolset in order to generate the > android application ... hopefully i will works.. > > I am worried because the NDK info says to have a "A Minimal set of > headers for C++ support" ... and i wonder if STL works or not ... > but, NDK r5 - android - suposse to also hav support for STLport ... > does any body has the hello-jni file modifyied for STL suppport ? > > NDK Doc also says that "Applications that use native activities must > be run on Android 2.3 (API Level 9) or later", but as i understand, i > will also needs JNI .. may somebody make some comments about it ? > > finally, may somebody share me a JNI example in order to pass some STL > functions between java and c++ ? > > comments are wellcome. > > regards, thanks in advance > > hector -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: STL android
hey Richard, thanks for helping ... in fact, i have installed SDK-NDK, read the CPLUSPLUS-SUPPORT.html doc, and preparing to compile my C++ STL stuff, but what i really am afraid is of JNI. There are interfaces depending of the filed's types, and i dont realize how to pass STL structures or pointers to them. I wonder if you have a kind of hello- jni example which you can share in this thread ? kriss, i agree with you, but development time is a real constraint :- ( On Jun 16, 3:25 pm, RichardC wrote: > Hi, > > I have a big "lump" of STL code that is building sucessfully using the > latest release of the Android-ndk (r5c). It just need a few tweaks. > It is called from Java via JNI as needed. > > I sugguest you download the > NDK:http://developer.android.com/sdk/ndk/index.html > > and read the docs specifically "CPLUSPLUS-SUPPORT.html" > > If you have any questions I will try and help. > > On Jun 16, 4:55 pm, "hectordu...@yahoo.com" > wrote: > > > hi guys, > > I would like to migrate a c/c++ (linux fedora 14) application to > > android 2.2. > > Because this will be my first migration, i have some questions about > > the procedure: > > > 1. considering it has some STL stuff, i wonder if it will work. I > > specially use vector, set, map and algoritms (set_union, > > set_intersection, set_difference). > > > 2. as i understand i have to write -first- a Java-JNI application > > which declares and interface my c functions and c++ methods. Those > > methods willl be included into one (or many) shared libraries ... is > > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don > > like the ones i've found :-( > > > 3- once ready, i must use the NDK toolset in order to generate the > > android application ... hopefully i will works.. > > > I am worried because the NDK info says to have a "A Minimal set of > > headers for C++ support" ... and i wonder if STL works or not ... > > but, NDK r5 - android - suposse to also hav support for STLport ... > > does any body has the hello-jni file modifyied for STL suppport ? > > > NDK Doc also says that "Applications that use native activities must > > be run on Android 2.3 (API Level 9) or later", but as i understand, i > > will also needs JNI .. may somebody make some comments about it ? > > > finally, may somebody share me a JNI example in order to pass some STL > > functions between java and c++ ? > > > comments are wellcome. > > > regards, thanks in advance > > > hector -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: STL android
I don't pass any STL structures across JNI, I pack/unpack just the data I need in to basic types or arrays of basic types, doing my own simple streaming as required. My application is a board game with the next move calculator in C++ and the UI (and game state) in Java, so there is not much to transfer between the two layers. If you have a lot of state you need to pass back and forth between C++ and Java I suggest you have a look at NativeActivity (I am just starting this myself - so I can be much help here). It looks like it by subclassing the Java NativeActivity class it should be possible to keep my entire engine (and it's state) in C++ and pass just the UI events across the JNI interface. I have not tried this yet - I can feel a test project coming on. On Jun 16, 10:06 pm, "hectordu...@yahoo.com" wrote: > hey Richard, thanks for helping ... in fact, i have installed SDK-NDK, > read the CPLUSPLUS-SUPPORT.html doc, and preparing to compile my C++ > STL stuff, but what i really am afraid is of JNI. There are interfaces > depending of the filed's types, and i dont realize how to pass STL > structures or pointers to them. I wonder if you have a kind of hello- > jni example which you can share in this thread ? > > kriss, i agree with you, but development time is a real constraint :- > ( > > On Jun 16, 3:25 pm, RichardC wrote: > > > > > > > > > Hi, > > > I have a big "lump" of STL code that is building sucessfully using the > > latest release of the Android-ndk (r5c). It just need a few tweaks. > > It is called from Java via JNI as needed. > > > I sugguest you download the > > NDK:http://developer.android.com/sdk/ndk/index.html > > > and read the docs specifically "CPLUSPLUS-SUPPORT.html" > > > If you have any questions I will try and help. > > > On Jun 16, 4:55 pm, "hectordu...@yahoo.com" > > wrote: > > > > hi guys, > > > I would like to migrate a c/c++ (linux fedora 14) application to > > > android 2.2. > > > Because this will be my first migration, i have some questions about > > > the procedure: > > > > 1. considering it has some STL stuff, i wonder if it will work. I > > > specially use vector, set, map and algoritms (set_union, > > > set_intersection, set_difference). > > > > 2. as i understand i have to write -first- a Java-JNI application > > > which declares and interface my c functions and c++ methods. Those > > > methods willl be included into one (or many) shared libraries ... is > > > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don > > > like the ones i've found :-( > > > > 3- once ready, i must use the NDK toolset in order to generate the > > > android application ... hopefully i will works.. > > > > I am worried because the NDK info says to have a "A Minimal set of > > > headers for C++ support" ... and i wonder if STL works or not ... > > > but, NDK r5 - android - suposse to also hav support for STLport ... > > > does any body has the hello-jni file modifyied for STL suppport ? > > > > NDK Doc also says that "Applications that use native activities must > > > be run on Android 2.3 (API Level 9) or later", but as i understand, i > > > will also needs JNI .. may somebody make some comments about it ? > > > > finally, may somebody share me a JNI example in order to pass some STL > > > functions between java and c++ ? > > > > comments are wellcome. > > > > regards, thanks in advance > > > > hector -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: STL android
yeah! i need to pass a pointer to a STL structure which is updated by each user interaction :-( I also have readen about NativeActivity but it also needs JNI in some way ... and passing the STL structures will be a requirement, yet. I only can package data into an own streaming if there is a second (concurrent) application runnning (implementing the STL functionality). Is it possible ? or .. does it nedd "natibe activity" regards Hector Other pssibility On Jun 17, 2:54 am, RichardC wrote: > I don't pass any STL structures across JNI, I pack/unpack just the > data I need in to basic types or arrays of basic types, doing my own > simple streaming as required. > > My application is a board game with the next move calculator in C++ > and the UI (and game state) in Java, so there is not much to transfer > between the two layers. > > If you have a lot of state you need to pass back and forth between C++ > and Java I suggest you have a look at NativeActivity (I am just > starting this myself - so I can be much help here). It looks like it > by subclassing the Java NativeActivity class it should be possible to > keep my entire engine (and it's state) in C++ and pass just the UI > events across the JNI interface. I have not tried this yet - I can > feel a test project coming on. > > On Jun 16, 10:06 pm, "hectordu...@yahoo.com" > wrote: > > > hey Richard, thanks for helping ... in fact, i have installed SDK-NDK, > > read the CPLUSPLUS-SUPPORT.html doc, and preparing to compile my C++ > > STL stuff, but what i really am afraid is of JNI. There are interfaces > > depending of the filed's types, and i dont realize how to pass STL > > structures or pointers to them. I wonder if you have a kind of hello- > > jni example which you can share in this thread ? > > > kriss, i agree with you, but development time is a real constraint :- > > ( > > > On Jun 16, 3:25 pm, RichardC wrote: > > > > Hi, > > > > I have a big "lump" of STL code that is building sucessfully using the > > > latest release of the Android-ndk (r5c). It just need a few tweaks. > > > It is called from Java via JNI as needed. > > > > I sugguest you download the > > > NDK:http://developer.android.com/sdk/ndk/index.html > > > > and read the docs specifically "CPLUSPLUS-SUPPORT.html" > > > > If you have any questions I will try and help. > > > > On Jun 16, 4:55 pm, "hectordu...@yahoo.com" > > > wrote: > > > > > hi guys, > > > > I would like to migrate a c/c++ (linux fedora 14) application to > > > > android 2.2. > > > > Because this will be my first migration, i have some questions about > > > > the procedure: > > > > > 1. considering it has some STL stuff, i wonder if it will work. I > > > > specially use vector, set, map and algoritms (set_union, > > > > set_intersection, set_difference). > > > > > 2. as i understand i have to write -first- a Java-JNI application > > > > which declares and interface my c functions and c++ methods. Those > > > > methods willl be included into one (or many) shared libraries ... is > > > > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don > > > > like the ones i've found :-( > > > > > 3- once ready, i must use the NDK toolset in order to generate the > > > > android application ... hopefully i will works.. > > > > > I am worried because the NDK info says to have a "A Minimal set of > > > > headers for C++ support" ... and i wonder if STL works or not ... > > > > but, NDK r5 - android - suposse to also hav support for STLport ... > > > > does any body has the hello-jni file modifyied for STL suppport ? > > > > > NDK Doc also says that "Applications that use native activities must > > > > be run on Android 2.3 (API Level 9) or later", but as i understand, i > > > > will also needs JNI .. may somebody make some comments about it ? > > > > > finally, may somebody share me a JNI example in order to pass some STL > > > > functions between java and c++ ? > > > > > comments are wellcome. > > > > > regards, thanks in advance > > > > > hector -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: STL android
yeah! i need to pass a pointer to a STL structure which is updated by each user interaction :-( I also have readen about NativeActivity but it also needs JNI in some way ... and passing the STL structures will be a requirement, yet. I only can package data into an own streaming if there is a second (concurrent) application runnning (implementing the STL functionality). Is it possible ? or .. does it nedd "natibe activity" regards Hector Other pssibility On Jun 17, 2:54 am, RichardC wrote: > I don't pass any STL structures across JNI, I pack/unpack just the > data I need in to basic types or arrays of basic types, doing my own > simple streaming as required. > > My application is a board game with the next move calculator in C++ > and the UI (and game state) in Java, so there is not much to transfer > between the two layers. > > If you have a lot of state you need to pass back and forth between C++ > and Java I suggest you have a look at NativeActivity (I am just > starting this myself - so I can be much help here). It looks like it > by subclassing the Java NativeActivity class it should be possible to > keep my entire engine (and it's state) in C++ and pass just the UI > events across the JNI interface. I have not tried this yet - I can > feel a test project coming on. > > On Jun 16, 10:06 pm, "hectordu...@yahoo.com" > wrote: > > > hey Richard, thanks for helping ... in fact, i have installed SDK-NDK, > > read the CPLUSPLUS-SUPPORT.html doc, and preparing to compile my C++ > > STL stuff, but what i really am afraid is of JNI. There are interfaces > > depending of the filed's types, and i dont realize how to pass STL > > structures or pointers to them. I wonder if you have a kind of hello- > > jni example which you can share in this thread ? > > > kriss, i agree with you, but development time is a real constraint :- > > ( > > > On Jun 16, 3:25 pm, RichardC wrote: > > > > Hi, > > > > I have a big "lump" of STL code that is building sucessfully using the > > > latest release of the Android-ndk (r5c). It just need a few tweaks. > > > It is called from Java via JNI as needed. > > > > I sugguest you download the > > > NDK:http://developer.android.com/sdk/ndk/index.html > > > > and read the docs specifically "CPLUSPLUS-SUPPORT.html" > > > > If you have any questions I will try and help. > > > > On Jun 16, 4:55 pm, "hectordu...@yahoo.com" > > > wrote: > > > > > hi guys, > > > > I would like to migrate a c/c++ (linux fedora 14) application to > > > > android 2.2. > > > > Because this will be my first migration, i have some questions about > > > > the procedure: > > > > > 1. considering it has some STL stuff, i wonder if it will work. I > > > > specially use vector, set, map and algoritms (set_union, > > > > set_intersection, set_difference). > > > > > 2. as i understand i have to write -first- a Java-JNI application > > > > which declares and interface my c functions and c++ methods. Those > > > > methods willl be included into one (or many) shared libraries ... is > > > > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don > > > > like the ones i've found :-( > > > > > 3- once ready, i must use the NDK toolset in order to generate the > > > > android application ... hopefully i will works.. > > > > > I am worried because the NDK info says to have a "A Minimal set of > > > > headers for C++ support" ... and i wonder if STL works or not ... > > > > but, NDK r5 - android - suposse to also hav support for STLport ... > > > > does any body has the hello-jni file modifyied for STL suppport ? > > > > > NDK Doc also says that "Applications that use native activities must > > > > be run on Android 2.3 (API Level 9) or later", but as i understand, i > > > > will also needs JNI .. may somebody make some comments about it ? > > > > > finally, may somebody share me a JNI example in order to pass some STL > > > > functions between java and c++ ? > > > > > comments are wellcome. > > > > > regards, thanks in advance > > > > > hector -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: STL android
yeah! i need to pass a pointer to a STL structure which is updated by each user interaction :-( I also have readen about NativeActivity but it also needs JNI in some way ... and passing the STL structures will be a requirement, yet. I only can package data into an own streaming if there is a second (concurrent) application runnning (implementing the STL functionality). Is it possible ? or .. does it nedd "natibe activity" regards Hector Other pssibility On Jun 17, 2:54 am, RichardC wrote: > I don't pass any STL structures across JNI, I pack/unpack just the > data I need in to basic types or arrays of basic types, doing my own > simple streaming as required. > > My application is a board game with the next move calculator in C++ > and the UI (and game state) in Java, so there is not much to transfer > between the two layers. > > If you have a lot of state you need to pass back and forth between C++ > and Java I suggest you have a look at NativeActivity (I am just > starting this myself - so I can be much help here). It looks like it > by subclassing the Java NativeActivity class it should be possible to > keep my entire engine (and it's state) in C++ and pass just the UI > events across the JNI interface. I have not tried this yet - I can > feel a test project coming on. > > On Jun 16, 10:06 pm, "hectordu...@yahoo.com" > wrote: > > > hey Richard, thanks for helping ... in fact, i have installed SDK-NDK, > > read the CPLUSPLUS-SUPPORT.html doc, and preparing to compile my C++ > > STL stuff, but what i really am afraid is of JNI. There are interfaces > > depending of the filed's types, and i dont realize how to pass STL > > structures or pointers to them. I wonder if you have a kind of hello- > > jni example which you can share in this thread ? > > > kriss, i agree with you, but development time is a real constraint :- > > ( > > > On Jun 16, 3:25 pm, RichardC wrote: > > > > Hi, > > > > I have a big "lump" of STL code that is building sucessfully using the > > > latest release of the Android-ndk (r5c). It just need a few tweaks. > > > It is called from Java via JNI as needed. > > > > I sugguest you download the > > > NDK:http://developer.android.com/sdk/ndk/index.html > > > > and read the docs specifically "CPLUSPLUS-SUPPORT.html" > > > > If you have any questions I will try and help. > > > > On Jun 16, 4:55 pm, "hectordu...@yahoo.com" > > > wrote: > > > > > hi guys, > > > > I would like to migrate a c/c++ (linux fedora 14) application to > > > > android 2.2. > > > > Because this will be my first migration, i have some questions about > > > > the procedure: > > > > > 1. considering it has some STL stuff, i wonder if it will work. I > > > > specially use vector, set, map and algoritms (set_union, > > > > set_intersection, set_difference). > > > > > 2. as i understand i have to write -first- a Java-JNI application > > > > which declares and interface my c functions and c++ methods. Those > > > > methods willl be included into one (or many) shared libraries ... is > > > > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don > > > > like the ones i've found :-( > > > > > 3- once ready, i must use the NDK toolset in order to generate the > > > > android application ... hopefully i will works.. > > > > > I am worried because the NDK info says to have a "A Minimal set of > > > > headers for C++ support" ... and i wonder if STL works or not ... > > > > but, NDK r5 - android - suposse to also hav support for STLport ... > > > > does any body has the hello-jni file modifyied for STL suppport ? > > > > > NDK Doc also says that "Applications that use native activities must > > > > be run on Android 2.3 (API Level 9) or later", but as i understand, i > > > > will also needs JNI .. may somebody make some comments about it ? > > > > > finally, may somebody share me a JNI example in order to pass some STL > > > > functions between java and c++ ? > > > > > comments are wellcome. > > > > > regards, thanks in advance > > > > > hector -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: STL android
yeah! i need to pass a pointer to a STL structure which is updated by each user interaction :-( I also have readen about NativeActivity but it also needs JNI in some way ... and passing the STL structures will be a requirement, yet. I only can package data into an own streaming if there is a second (concurrent) application runnning (implementing the STL functionality). Is it possible ? or .. does it nedd "natibe activity" regards Hector Other pssibility On Jun 17, 2:54 am, RichardC wrote: > I don't pass any STL structures across JNI, I pack/unpack just the > data I need in to basic types or arrays of basic types, doing my own > simple streaming as required. > > My application is a board game with the next move calculator in C++ > and the UI (and game state) in Java, so there is not much to transfer > between the two layers. > > If you have a lot of state you need to pass back and forth between C++ > and Java I suggest you have a look at NativeActivity (I am just > starting this myself - so I can be much help here). It looks like it > by subclassing the Java NativeActivity class it should be possible to > keep my entire engine (and it's state) in C++ and pass just the UI > events across the JNI interface. I have not tried this yet - I can > feel a test project coming on. > > On Jun 16, 10:06 pm, "hectordu...@yahoo.com" > wrote: > > > hey Richard, thanks for helping ... in fact, i have installed SDK-NDK, > > read the CPLUSPLUS-SUPPORT.html doc, and preparing to compile my C++ > > STL stuff, but what i really am afraid is of JNI. There are interfaces > > depending of the filed's types, and i dont realize how to pass STL > > structures or pointers to them. I wonder if you have a kind of hello- > > jni example which you can share in this thread ? > > > kriss, i agree with you, but development time is a real constraint :- > > ( > > > On Jun 16, 3:25 pm, RichardC wrote: > > > > Hi, > > > > I have a big "lump" of STL code that is building sucessfully using the > > > latest release of the Android-ndk (r5c). It just need a few tweaks. > > > It is called from Java via JNI as needed. > > > > I sugguest you download the > > > NDK:http://developer.android.com/sdk/ndk/index.html > > > > and read the docs specifically "CPLUSPLUS-SUPPORT.html" > > > > If you have any questions I will try and help. > > > > On Jun 16, 4:55 pm, "hectordu...@yahoo.com" > > > wrote: > > > > > hi guys, > > > > I would like to migrate a c/c++ (linux fedora 14) application to > > > > android 2.2. > > > > Because this will be my first migration, i have some questions about > > > > the procedure: > > > > > 1. considering it has some STL stuff, i wonder if it will work. I > > > > specially use vector, set, map and algoritms (set_union, > > > > set_intersection, set_difference). > > > > > 2. as i understand i have to write -first- a Java-JNI application > > > > which declares and interface my c functions and c++ methods. Those > > > > methods willl be included into one (or many) shared libraries ... is > > > > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don > > > > like the ones i've found :-( > > > > > 3- once ready, i must use the NDK toolset in order to generate the > > > > android application ... hopefully i will works.. > > > > > I am worried because the NDK info says to have a "A Minimal set of > > > > headers for C++ support" ... and i wonder if STL works or not ... > > > > but, NDK r5 - android - suposse to also hav support for STLport ... > > > > does any body has the hello-jni file modifyied for STL suppport ? > > > > > NDK Doc also says that "Applications that use native activities must > > > > be run on Android 2.3 (API Level 9) or later", but as i understand, i > > > > will also needs JNI .. may somebody make some comments about it ? > > > > > finally, may somebody share me a JNI example in order to pass some STL > > > > functions between java and c++ ? > > > > > comments are wellcome. > > > > > regards, thanks in advance > > > > > hector -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: STL android
"me doy el lapo!" difficult decition, but i have decided to port everything to java and get advantage of the android technology :-( i have realized that both, java and SQlite afford all the functionality i have been working with STL, and in the short time i can use all the pissibilities that android has, instead of been dealing each time with c/c++ and JNI :-) thanks you guys, for alll your comments ... On Jun 17, 11:58 am, "hectordu...@yahoo.com" wrote: > yeah! > i need to pass a pointer to a STL structure which is updated by each > user interaction :-( > I also have readen about NativeActivity but it also needs JNI in some > way ... and passing the STL structures will be a requirement, yet. > > I only can package data into an own streaming if there is a second > (concurrent) application runnning (implementing the STL > functionality). Is it possible ? > or .. does it nedd "natibe activity" > regards > > Hector > > Other pssibility > On Jun 17, 2:54 am, RichardC wrote: > > > I don't pass any STL structures across JNI, I pack/unpack just the > > data I need in to basic types or arrays of basic types, doing my own > > simple streaming as required. > > > My application is a board game with the next move calculator in C++ > > and the UI (and game state) in Java, so there is not much to transfer > > between the two layers. > > > If you have a lot of state you need to pass back and forth between C++ > > and Java I suggest you have a look at NativeActivity (I am just > > starting this myself - so I can be much help here). It looks like it > > by subclassing the Java NativeActivity class it should be possible to > > keep my entire engine (and it's state) in C++ and pass just the UI > > events across the JNI interface. I have not tried this yet - I can > > feel a test project coming on. > > > On Jun 16, 10:06 pm, "hectordu...@yahoo.com" > > wrote: > > > > hey Richard, thanks for helping ... in fact, i have installed SDK-NDK, > > > read the CPLUSPLUS-SUPPORT.html doc, and preparing to compile my C++ > > > STL stuff, but what i really am afraid is of JNI. There are interfaces > > > depending of the filed's types, and i dont realize how to pass STL > > > structures or pointers to them. I wonder if you have a kind of hello- > > > jni example which you can share in this thread ? > > > > kriss, i agree with you, but development time is a real constraint :- > > > ( > > > > On Jun 16, 3:25 pm, RichardC wrote: > > > > > Hi, > > > > > I have a big "lump" of STL code that is building sucessfully using the > > > > latest release of the Android-ndk (r5c). It just need a few tweaks. > > > > It is called from Java via JNI as needed. > > > > > I sugguest you download the > > > > NDK:http://developer.android.com/sdk/ndk/index.html > > > > > and read the docs specifically "CPLUSPLUS-SUPPORT.html" > > > > > If you have any questions I will try and help. > > > > > On Jun 16, 4:55 pm, "hectordu...@yahoo.com" > > > > wrote: > > > > > > hi guys, > > > > > I would like to migrate a c/c++ (linux fedora 14) application to > > > > > android 2.2. > > > > > Because this will be my first migration, i have some questions about > > > > > the procedure: > > > > > > 1. considering it has some STL stuff, i wonder if it will work. I > > > > > specially use vector, set, map and algoritms (set_union, > > > > > set_intersection, set_difference). > > > > > > 2. as i understand i have to write -first- a Java-JNI application > > > > > which declares and interface my c functions and c++ methods. Those > > > > > methods willl be included into one (or many) shared libraries ... is > > > > > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don > > > > > like the ones i've found :-( > > > > > > 3- once ready, i must use the NDK toolset in order to generate the > > > > > android application ... hopefully i will works.. > > > > > > I am worried because the NDK info says to have a "A Minimal set of > > > > > headers for C++ support" ... and i wonder if STL works or not ... > > > > > but, NDK r5 - android - suposse to also hav support for STLport ... > > > > > does any body has the hello-jni file modifyied for STL suppport ? > > > > > > NDK Doc also says that "Applications that use native activities must > > > > > be run on Android 2.3 (API Level 9) or later", but as i understand, i > > > > > will also needs JNI .. may somebody make some comments about it ? > > > > > > finally, may somebody share me a JNI example in order to pass some STL > > > > > functions between java and c++ ? > > > > > > comments are wellcome. > > > > > > regards, thanks in advance > > > > > > hector -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=
Re: [android-developers] Re: STL android
Unfortunately if you're doing heavy computing, it might *not* make sense. This is typically the quickest way to kill the battery, and your application probably is not structured to fit the android specifics. (For example, what happens if your app is killed after running for a while? This doesn't happen in linux, but certainly happens on Android.) You'll have to use the NDK-JNI if you want to keep any of your c++ code. How much do you have? Rough estimate? You don't have access to the "old world" unix IPC, mostly because of restrictions imposed for security reasons. Difficulty of porting c++/stl to Java should be minimal. It will take time, but the languages are fairly similar. The thing that will really take time is restructuring your application to work within the Android process model, which might require a methodology change depending on your apps structure. I'm trusting that if your code is complex enough you won't give away what it does, then you shouldn't have any trouble learning to port it :o)... Kris On Thu, Jun 16, 2011 at 3:17 PM, hectordu...@yahoo.com < hectordu...@yahoo.com> wrote: > hello Kris, thanks for answering. > Well ... in my case it makes sense :-( but i don want to go into > functionality details. Fact is that i have a c/c++(STL) application > which makes some computations :-( and i need it to communicate in any > way with a java-androide aplication which will be the UI: one option > is NDK-JNI but if possible, i would like to avoid JNI. I wonder, may i > run my c++(STL) appl concurrently with the java UI and communicate > both of them in order to change some basic information? .. sockets ... > pipes ... other .. without JNI ? > > any way, a NDK-JNI-c++-STL example will be very welcome, if any one of > you guys may share it .. > > and, by the way, how can i port (easy) C++/STL to java ??? > > > On Jun 16, 1:51 pm, Kristopher Micinski > wrote: > > What application are you trying to migrate? > > > > Android is different enough, that you will probably be better off > rewriting > > the application in the SDK framework. > > > > The NDK wasn't designed to write whole applications, depending on how > large > > your app is it might be better to rewrite the whole thing. But perhaps > > another solution is to keep what you can, and change what you need. > > > > In any case, most of the time, dropping a few thousand lines of c++ into > a > > mobile environment just doesn't make sense (i.e., the environment is > > different enough that structuring your app different might really be > needed, > > and if it's a batch processing app it might not make sense to perform > some > > of the operations in a mobile environment...) > > > > Kris > > > > On Thu, Jun 16, 2011 at 11:55 AM, hectordu...@yahoo.com < > > > > hectordu...@yahoo.com> wrote: > > > hi guys, > > > I would like to migrate a c/c++ (linux fedora 14) application to > > > android 2.2. > > > Because this will be my first migration, i have some questions about > > > the procedure: > > > > > 1. considering it has some STL stuff, i wonder if it will work. I > > > specially use vector, set, map and algoritms (set_union, > > > set_intersection, set_difference). > > > > > 2. as i understand i have to write -first- a Java-JNI application > > > which declares and interface my c functions and c++ methods. Those > > > methods willl be included into one (or many) shared libraries ... is > > > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don > > > like the ones i've found :-( > > > > > 3- once ready, i must use the NDK toolset in order to generate the > > > android application ... hopefully i will works.. > > > > > I am worried because the NDK info says to have a "A Minimal set of > > > headers for C++ support" ... and i wonder if STL works or not ... > > > but, NDK r5 - android - suposse to also hav support for STLport ... > > > does any body has the hello-jni file modifyied for STL suppport ? > > > > > NDK Doc also says that "Applications that use native activities must > > > be run on Android 2.3 (API Level 9) or later", but as i understand, i > > > will also needs JNI .. may somebody make some comments about it ? > > > > > finally, may somebody share me a JNI example in order to pass some STL > > > functions between java and c++ ? > > > > > comments are wellcome. > > > > > regards, thanks in advance > > > > > hector > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to > android-developers@googlegroups.com > > > To unsubscribe from this group, send email to > > > android-developers+unsubscr...@googlegroups.com > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > T
Re: [android-developers] Re: STL android
Java has a standard library that makes use of a constrained parametric polymorphism in the form of "generics." You can see tons of examples, List, Set, etc... This is pretty basic Java stuff, if you can write in C++, learning and using Java should be easy. Kris On Thu, Jun 16, 2011 at 3:51 PM, hectordu...@yahoo.com < hectordu...@yahoo.com> wrote: > kris, what is the java equivalent to stl (c++) ? > i agree, if easy, i would prefere to port it :-(...and to avooid > JNI... > > On Jun 16, 2:28 pm, Kristopher Micinski > wrote: > > Unfortunately if you're doing heavy computing, it might *not* make sense. > > This is typically the quickest way to kill the battery, and your > > application probably is not structured to fit the android specifics. > (For > > example, what happens if your app is killed after running for a while? > This > > doesn't happen in linux, but certainly happens on Android.) > > > > You'll have to use the NDK-JNI if you want to keep any of your c++ code. > > How much do you have? Rough estimate? > > > > You don't have access to the "old world" unix IPC, mostly because of > > restrictions imposed for security reasons. > > > > Difficulty of porting c++/stl to Java should be minimal. It will take > time, > > but the languages are fairly similar. The thing that will really take > time > > is restructuring your application to work within the Android process > model, > > which might require a methodology change depending on your apps > structure. > > I'm trusting that if your code is complex enough you won't give away > what > > it does, then you shouldn't have any trouble learning to port it :o)... > > > > Kris > > > > On Thu, Jun 16, 2011 at 3:17 PM, hectordu...@yahoo.com < > > > > hectordu...@yahoo.com> wrote: > > > hello Kris, thanks for answering. > > > Well ... in my case it makes sense :-( but i don want to go into > > > functionality details. Fact is that i have a c/c++(STL) application > > > which makes some computations :-( and i need it to communicate in any > > > way with a java-androide aplication which will be the UI: one option > > > is NDK-JNI but if possible, i would like to avoid JNI. I wonder, may i > > > run my c++(STL) appl concurrently with the java UI and communicate > > > both of them in order to change some basic information? .. sockets ... > > > pipes ... other .. without JNI ? > > > > > any way, a NDK-JNI-c++-STL example will be very welcome, if any one of > > > you guys may share it .. > > > > > and, by the way, how can i port (easy) C++/STL to java ??? > > > > > On Jun 16, 1:51 pm, Kristopher Micinski > > > wrote: > > > > What application are you trying to migrate? > > > > > > Android is different enough, that you will probably be better off > > > rewriting > > > > the application in the SDK framework. > > > > > > The NDK wasn't designed to write whole applications, depending on how > > > large > > > > your app is it might be better to rewrite the whole thing. But > perhaps > > > > another solution is to keep what you can, and change what you need. > > > > > > In any case, most of the time, dropping a few thousand lines of c++ > into > > > a > > > > mobile environment just doesn't make sense (i.e., the environment is > > > > different enough that structuring your app different might really be > > > needed, > > > > and if it's a batch processing app it might not make sense to perform > > > some > > > > of the operations in a mobile environment...) > > > > > > Kris > > > > > > On Thu, Jun 16, 2011 at 11:55 AM, hectordu...@yahoo.com < > > > > > > hectordu...@yahoo.com> wrote: > > > > > hi guys, > > > > > I would like to migrate a c/c++ (linux fedora 14) application to > > > > > android 2.2. > > > > > Because this will be my first migration, i have some questions > about > > > > > the procedure: > > > > > > > 1. considering it has some STL stuff, i wonder if it will work. I > > > > > specially use vector, set, map and algoritms (set_union, > > > > > set_intersection, set_difference). > > > > > > > 2. as i understand i have to write -first- a Java-JNI application > > > > > which declares and interface my c functions and c++ methods. Those > > > > > methods willl be included into one (or many) shared libraries ... > is > > > > > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don > > > > > like the ones i've found :-( > > > > > > > 3- once ready, i must use the NDK toolset in order to generate the > > > > > android application ... hopefully i will works.. > > > > > > > I am worried because the NDK info says to have a "A Minimal set of > > > > > headers for C++ support" ... and i wonder if STL works or not ... > > > > > but, NDK r5 - android - suposse to also hav support for STLport ... > > > > > does any body has the hello-jni file modifyied for STL suppport ? > > > > > > > NDK Doc also says that "Applications that use native activities > must > > > > > be run on Android 2.3 (API Level 9) or later", but as i understand, > i > > > > > will
Re: [android-developers] Re: STL android
The only thing I see is that the framework is entirely different. I used to think that putting huge "lumps" of c++ and interfacing through the ndk might be feasible, but if you've got a large batch of c++ code that *doesn't* need the niceties of the Android SDK, what is it doing? I've found that if you're code isn't doing much external interaction (which you'll need some android facilities for) you're probably doing something very CPU bound, which doesn't always make sense in these types of environments anyway. (Though, of course, there are exceptions, we had a project last semester that ran all UI stuff in an app, then a lot of signal processing code in c++ library.) I guess my point is this: the NDK isn't an excuse not to learn Java and write your app the proper way. Kris On Thu, Jun 16, 2011 at 4:25 PM, RichardC wrote: > Hi, > > I have a big "lump" of STL code that is building sucessfully using the > latest release of the Android-ndk (r5c). It just need a few tweaks. > It is called from Java via JNI as needed. > > I sugguest you download the NDK: > http://developer.android.com/sdk/ndk/index.html > > and read the docs specifically "CPLUSPLUS-SUPPORT.html" > > If you have any questions I will try and help. > > On Jun 16, 4:55 pm, "hectordu...@yahoo.com" > wrote: > > hi guys, > > I would like to migrate a c/c++ (linux fedora 14) application to > > android 2.2. > > Because this will be my first migration, i have some questions about > > the procedure: > > > > 1. considering it has some STL stuff, i wonder if it will work. I > > specially use vector, set, map and algoritms (set_union, > > set_intersection, set_difference). > > > > 2. as i understand i have to write -first- a Java-JNI application > > which declares and interface my c functions and c++ methods. Those > > methods willl be included into one (or many) shared libraries ... is > > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don > > like the ones i've found :-( > > > > 3- once ready, i must use the NDK toolset in order to generate the > > android application ... hopefully i will works.. > > > > I am worried because the NDK info says to have a "A Minimal set of > > headers for C++ support" ... and i wonder if STL works or not ... > > but, NDK r5 - android - suposse to also hav support for STLport ... > > does any body has the hello-jni file modifyied for STL suppport ? > > > > NDK Doc also says that "Applications that use native activities must > > be run on Android 2.3 (API Level 9) or later", but as i understand, i > > will also needs JNI .. may somebody make some comments about it ? > > > > finally, may somebody share me a JNI example in order to pass some STL > > functions between java and c++ ? > > > > comments are wellcome. > > > > regards, thanks in advance > > > > hector > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en