Port x86 program to Android met error

48 views
Skip to first unread message

mundou

unread,
Dec 12, 2009, 4:16:34 AM12/12/09
to android-porting
Hi, all!

I'm recently trying to port a x86 linux application to Android
platform, using android-ndk 1.6 and ndk wrapper. When compiling the
codes I met the following problem:


My codes uses usleep() function defined in <unistd.h> and tries to
get
its return value like this:


return usleep(microseconds * 1000);


However, <unistd.h> in x86 system defines usleep as


extern int usleep ( __useconds_t __useconds );


while <unistd.h> in Android NDK defines it as


extern void usleep(unsigned long);


Now I had to change my code as:


usleep( microseconds * 1000 );
return 0;


I'm not sure if it's safe to do so. Does anyone have some idea about
this? Or a better solution?


Thanks very much!


Mundou


Hoegaarden

unread,
Dec 13, 2009, 1:52:45 AM12/13/09
to android...@googlegroups.com
I think if your porgram do not have to care about the error returned by usleep, it is OK, but 

2009/12/12 mundou <wenta...@gmail.com>

enh

unread,
Dec 14, 2009, 7:27:24 PM12/14/09
to android-porting
this is a bug in our C library. for now, you'll have to assume
success. i'll knock up a patch so we get this fixed...

--elliott

enh

unread,
Jan 7, 2010, 6:55:42 PM1/7/10
to android-porting
fix submitted. thanks for the bug report!

--elliott

Reply all
Reply to author
Forward
0 new messages