Hi and there is my issue:
I'm trying to create a shared memory segment using this code snippet:
#include <boost/interprocess/managed_shared_memory.hpp>
using namespace boost::interprocess;
...
shared_memory_object::remove("MyShareMem");
try {
managed_shared_memory segment_(create_only,
"MyShareMem",
10 * 1024 * 1024);
...
}
catch (interprocess_exception &ex) {
std::cout << "Exception: "<< ex.what() << std::endl;
}
But then I've got an exception:
Exception: boost::interprocess::intermodule_singleton initialization failed
I am rather at a loss of what to do and how to fix the issue.
Is there any ideas how to deal with this?
UPDATED:
I found solution here boost::interprocess_exception - library_error exception when creating shared_memory_object
It's a bit weird, but here boost relies on Windows Event Logger. And if there is no event with ID = 6005. It throws an exception.
The code snippet from the boost 1.62.0 win32_api.hpp
//Obtains the bootup time from the System Event Log,
//event ID == 6005 (event log started).
//Adapted from http://msdn.microsoft.com/en-us/library/windows/desktop/bb427356.aspx
inline bool get_last_bootup_time(std::string &stamp)
{
const char *source_name = "System";
const char *provider_name = "EventLog";
const unsigned short event_id = 6005u;
The solution was just to add the event 6005 and all work again fine.