Create shared memory for several processes by using only native C++ operations? [closed]

StackOverflow https://stackoverflow.com/questions/16624400

سؤال

How can I allocate shared memory accessible from multiple processes by using only native C++ operations? Or should I use my OS API as it is in the case of inter thread synchronization objects such as mutex and semaphores are? (I mean you can not use bool instead of mutex. OS has specific types for organizing the synchronization.)

هل كانت مفيدة؟

المحلول

There is no notion of "shared memory", or even "process", in "only native C++". Those are necessarily platform-specific concepts.

You can try Boost's Interprocess library for some useful abstractions.

نصائح أخرى

Basically, you need to use OS API. But there are cross-platform libraries (e.g. Boost) which implement access to a shared memory.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top