How to use shared memory in android native code?

2020-03-25 06:32发布

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

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?

1条回答
干净又极端
2楼-- · 2020-03-25 06:58

Android intentionally doesn't provide SysV IPC. Try to avoid using of shared memory or, if you really want, look for examples of using ashmem.

查看更多
登录 后发表回答