Reputation:
Does anyone have an example of CreateSharedMemory function (Windows) usage? In a shared internal memory client/server software scenario the server input parameters to the function are only MaxSize
and InitialSize
, so just how can the client know what memory address is shared? CreateFileMapping solves this since you can name each file mapping object. I know that Boost has similar features, but I'm looking to solve this using the raw Windows API functionality.
Upvotes: 0
Views: 1820
Reputation: 7829
I suppose you got confused by the "client" and "server" terminology on the page. Out of LSA (windows security) context it may seem that CreateSharedMemory
does what you want. It does not: the function is designed and used only in a windows security and authentication context.
Despite the name, is not a (general purpose) function to allocate shared memory between two processes.
What you need, for sharing memory between processes is done (usually) by page-file backed memory mapped files, so through CreateFileMapping
etc.
Other techniques exists, but I would recommend using page-file backed memory mapped files.
Upvotes: 5