以下是官方的BOOST文檔。 爲什麼在撥打region.get_size()
時總是得到零大小?我究竟做錯了什麼?C++ BOOST:windows共享內存get_size()返回零
int main(int argc, char *argv[])
{
//Create a native windows shared memory object.
windows_shared_memory shm (create_only, "MySharedMemory", read_write, 1000);
//Map the whole shared memory in this process
mapped_region region(shm, read_write);
cout << "SIZE IS " << region.get_size() << endl;
return 0;
}
不是根據文檔。不應該在窗口中調用帶有大小的mapped_region。看到我上面的答案 – GabiMe 2010-07-29 21:00:59