Porting of Windows native code to android

1,155 views
Skip to first unread message

MMM

unread,
Jul 18, 2012, 6:47:08 AM7/18/12
to andro...@googlegroups.com
I have already developed Windows application with native code. I have some queries for porting this application to android by using NDK as follows:
 
1) I am using data structures like list, queue etc in my application. Do ndk supports such data types? Which headers I need to include?
 
2) In my application, I am using Window APIs like createHandle, CloseHandle, also thread specific waitForSingleObject. How to port these methods to ndk native code for android?
 
Thanks
 

RichardC

unread,
Jul 18, 2012, 8:18:50 AM7/18/12
to andro...@googlegroups.com

On Wednesday, July 18, 2012 11:47:08 AM UTC+1, MMM wrote:
I have already developed Windows application with native code. I have some queries for porting this application to android by using NDK as follows:
 
1) I am using data structures like list, queue etc in my application. Do ndk supports such data types? Which headers I need to include?
 
Read android-ndk/docs/CPLUSPLUS-SUPPORT.html and then choose the right C++ support you need. For example, if you choose "gnustl" the you can see from the table in the document that you get:
  • C++ Exceptions
  • C++ RTTI    
  • Standard Library
So just include the header files you are using now, but you need to check its license terms.

 
2) In my application, I am using Window APIs like createHandle, CloseHandle, also thread specific waitForSingleObject. How to port these methods to ndk native code for android?
 
 
All the functions you mention are Win32/64 specific, you need to remove them and and change the code using them.  There is no simple/trivial answer, Android should have the equivalent functionality but there is no simple 1-to-1 mapping of API calls. For example, "waitForSingleObject" is probably going to be replace with one of the Posix functions in <pthread.h>, but which one and what parameters it takes you will need to workout referencing how you called "waitForSingleObject".
There are plenty of docs and help available if you search for things like "linux thread locking" etc.

  
Thanks
 

MMM

unread,
Jul 20, 2012, 7:15:26 AM7/20/12
to andro...@googlegroups.com
Thanks
 
Now I am able to use list, queue, map etc. :)
 

jeff shanab

unread,
Sep 26, 2012, 7:58:53 AM9/26/12
to andro...@googlegroups.com
I have a windows app I needed to port to linux and I replaced WaitForMultipleObjects with a list of callbacks and a single condition variable. I found an example by googleing for a replacement. I used a template to make it work on many types of objects. That concept should work on android.

ie
http://stackoverflow.com/questions/1410649/waiting-for-multiple-condition-variables-in-boost

On Tue, Sep 25, 2012 at 11:44 PM, Matthew Sciberras <bogim...@gmail.com> wrote:
Hi,
I found myself in your position, i.e. I have a Windows application written in C++ and I need to port it to Android.
Did you find any way to use the WindowsAPI function, such WaitForMultipleObjects() etc.

Thanks


On Friday, July 20, 2012 1:15:26 PM UTC+2, MMM wrote:
Thanks
 
Now I am able to use list, queue, map etc. :)
 

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-ndk/-/C1VUQIHBjkkJ.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.

Reply all
Reply to author
Forward
0 new messages