Android G1 native c and SDL

SDL runs on android emulator. Download SDL and compile with following options. You need to replace /dev/fb0 with /dev/graphics/fb0 in SDL_fbvideo.c or your app will return error no video device found.

./configure \
CC=arm-none-linux-gnueabi-gcc \
--host=arm-linux \
--enable-audio=no \
--enable-video=yes \
--enable-cdrom=no \
--enable-joystick=no \
--enable-threads=no \
--enable-timers=no \
--enable-loadso=no \
--enable-video-fbcon=yes \
--enable-shared=no \
--enable-sdl-dlopen=no \
--enable-video-x11=no \
--enable-x11-shared=no \
--enable-dga=no \
--enable-video-dga=no \
--enable-video-x11-dgamouse=no \
--enable-video-x11-vm=no \
--enable-video-x11-xv=no \
--enable-video-x11-xinerama=no \
--enable-video-x11-xme=no \
--enable-video-x11-xrandr=no \
--enable-video-x11-dpms=no \
--enable-video-photon=no \
--enable-video-carbon=no \
--enable-video-cocoa=no \
--enable-video-fbcon=yes \
--enable-video-directfb=no \
--enable-video-ps2gs=no \
--enable-video-ggi=no \
--enable-video-svga=no \
--enable-video-vgl=no \
--enable-video-wscons=no \
--enable-video-aalib=no \
--enable-video-qtopia=no \
--enable-video-picogui=no \
--enable-video-xbios=no \
--enable-video-gem=no \
--enable-video-dummy=no \
--enable-video-opengl=no \

I tested with the following c files

#include

int main(int argc, char **argv)
{
printf("\nHello SDL User!\n");

/* initialize SDL */
if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
{
fprintf( stderr, "Video initialization failed: %s\n",
SDL_GetError( ) );
SDL_Quit( );
}

SDL_Quit( );

return 0;
}

#include
#include
#include

int main(int argc, char * argv[])
{
SDL_Surface * scr;
SDL_Rect rect;
int i,j;
static int k;
Uint8 r, g, b;

/* Init SDL: */

printf("about to init\n");

printf("test point %d\n",1);

if (SDL_Init(SDL_INIT_VIDEO) < 0 )
{
fprintf(stderr, "Can't init: %s\n",
SDL_GetError());
exit(1);
}

printf("test point %d\n",2);
/* Open screen: */

scr = SDL_SetVideoMode(320, 480, 16,
SDL_HWSURFACE);

printf("test point %d\n",3);
for (i = 0; i < 16; i++)
{
/* Determine where to draw rect: */

rect.x = i * 10;
rect.y = i * 7;
rect.w = 100;
rect.h = 50;

/* What color should it be? */

r = (i * 4);
g = ((64 - i) * 4);
b = (i % 4) * 64;

/* Draw a rectangle on the screen: */

SDL_FillRect(scr, &rect,
SDL_MapRGB(scr->format,
r, g, b));

SDL_UpdateRect(scr,
rect.x, rect.y,
rect.w, rect.h);

/* Wait five seconds: */

// SDL_Delay(1000);
for(j=0;j<100000;j++){
k=j;

}
}
printf("about to quit\n");

/* Quit: */

SDL_Quit();

return(0);
}

works fine after pusing to emulator and compiling with static and linking to sdl .a file