mk.. mk.. - 1 year ago 148
Android Question

How to use shared memory in android native code?

I am porting an existing linux application to android. The application is using shared memory API's like


Checking bionic in android source, I see that these API's are not supported. Hence I get a linking error during build.

external/l2/avbtp.c:138: error: undefined reference to 'shm_open'
external/l2/avbtp.c:151: error: undefined reference to 'shm_unlink'
external/l2/avbtp.c:186: error: undefined reference to 'shm_unlink'

How to resolve this correctly?

Answer Source

Well, I found this github project and well it works!

Like a magic, it works perfectly. You can use shared memory in android across independent processes using shmget(), shmat() and shmdt() API's seamlessly. Give it a try.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download