
El 21/06/2013 18:13, Riskybiz escribió:
I'm trying to create a wrapper class to control a managed shared memory segment using Boost::Interprocess. I'm having trouble reading data from the shared memory vector of strings...
When the vector is instantiated in the managed shared segment I place in the first vector element a test string; "testing testing 1 2 3". Immediately after placing it there and in the scope of the same code block I can access the vector element and print out the string using std::cout.
However when I try to read the vector element using the read() function the test program crashes. The problem is with the line:
You are instantiated managed_shared_memory m_segment as local variable. When the function ends, this class is destroyed and the shared memory unmapped. So accesing this shared memory will provoke an access violation error. Put this variable as a member variable. Best, Ion