Communication using Shared Memory between VC++ and

2019-09-05 12:44发布

问题:

I am using FileMapping for implementing shared memory concept in a C++ windows form application and QSharedMemory in Qt application.

I want to read data written by C++ form application using FileMapping technique, in Qt application using QsharedMemory.

Is it possible? If not please suggest appropriate methods to implement this feature.

回答1:

I'm not quite sure of the detail of your implementation, however I would suggest that a better more uniform way to approach this would be by using boost::InterProcess - which provides mechanisms that could be used in both processes and then utilize common code.

http://www.boost.org/doc/libs/1_52_0/doc/html/interprocess/sharedmemorybetweenprocesses.html

The other reason is that the library provides mechanisms for synchronisation and other IPC mechanisms that may be useful in the future.

http://www.boost.org/doc/libs/1_52_0/doc/html/interprocess/synchronization_mechanisms.html