在VC ++和Qt应用程序之间使用共享内存进行通信 [英] Communication using Shared Memory between VC++ and Qt applications

查看:976
本文介绍了在VC ++和Qt应用程序之间使用共享内存进行通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FileMapping在C ++ Windows窗体应用程序中实现共享内存概念,并在Qt应用程序中实现QSharedMemory.

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

我想在使用QsharedMemory的Qt应用程序中使用FileMapping技术读取由C ++表单应用程序编写的数据.

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.

推荐答案

我不确定您的实现细节,但是我建议使用boost::InterProcess -提供了可以在两个过程中使用并随后利用通用代码的机制.

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

另一个原因是该库提供了用于同步的机制以及将来可能有用的其他IPC机制.

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

这篇关于在VC ++和Qt应用程序之间使用共享内存进行通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆