Вопрос

Is it possible to share a memory region between an application compiled with MinGW and one with Visual Studio ?

I am relying on boost interprocess:

  shared_memory_object shm (create_only, "MySharedMemory", read_write);
  shm.truncate(1000);
  mapped_region region(shm, read_write);
  int *pi = (int *)region.get_address();

I already realized that this is not possible via Cygwin, as the boost shared_memory_object is then created via the Cygwin posix layer.

Это было полезно?

Решение

A simple test program confirms that it is possible. One caveat is to use the exact same boost versions. Between boost 1.53 and 1.54 the unique id creation for the underlying memory mapped file has apparently changed. I did however not check for memory alignment issues.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top