Boost 如何与out proc*.exe COM服务器的各个部分进行通信?

Boost 如何与out proc*.exe COM服务器的各个部分进行通信?,boost,com,ipc,boost-interprocess,inproc,Boost,Com,Ipc,Boost Interprocess,Inproc,我们有*.exe应用程序,它也是进程COM服务器 主线程正在执行一些网络例程:它接收数据包并将它们放入队列 COM客户机,例如VBA,使用COM服务器,也希望使用队列。尽管它们位于同一地址空间,但问题是: 我们如何为COM客户端提供与exe进程同时使用队列的机会 有一个使用共享内存的想法,但没有成功 UPD: 我尝试使用boost::interprocess。 由于相同的地址空间,我只想共享对象指针 std::vector<int> //just example of MyType

我们有*.exe应用程序,它也是进程COM服务器

主线程正在执行一些网络例程:它接收数据包并将它们放入队列

COM客户机,例如VBA,使用COM服务器,也希望使用队列。尽管它们位于同一地址空间,但问题是:

我们如何为COM客户端提供与exe进程同时使用队列的机会

有一个使用共享内存的想法,但没有成功

UPD:

我尝试使用boost::interprocess。 由于相同的地址空间,我只想共享对象指针

std::vector<int> //just example of MyType
UPD2:


我刚刚用try{}catch{}包围了Com部件,发现消息“File not found”出现异常

,共享内存(或内存映射文件)有什么问题?这是最简单的方法(假设您使用同步原语(如事件和关键部分/互斥体)来保护内存)?通过什么魔法使EXE像DLL一样在进程中加载?它不包含所需的重新定位信息。我已经修复了它,但问题仍然是共享内存(或内存映射文件)有什么问题?这是最简单的方法(假设您使用同步原语(如事件和关键部分/互斥体)来保护内存)?通过什么魔法使EXE像DLL一样在进程中加载?它不包含所需的搬迁信息。我已经解决了,但问题仍然是实际的
main()
...
using namespace boost::interprocess;
struct shm_remove 
{
    shm_remove() { shared_memory_object::remove("SharedMemory"); }
    ~shm_remove(){ shared_memory_object::remove("SharedMemory"); }
} remover;

managed_shared_memory segment(open_or_create, "SharedMemory", 65536);
std::vector<int>** instance = segment.construct<std::vector<int>* >
   ("my_instance")  //name of the object
   ();            //ctor first argument
*instance = new std::vector<int>();
(*instance)->push_back(1);

// initialize the COM library
::CoInitialize(NULL);`enter code here`
HRESULT __stdcall CoMyCOMServer::Add(int *value)
{
cout << "Add()\n";

// this line goes out of debug, then VBA get error
managed_shared_memory segment(open_only, "SharedMemory"); 
std::vector<int>* *res = segment.find<std::vector<int>* > ("my_instance").first;
(*res)->push_back(*value);

return S_OK;
}
Dim obj As IMyCOMServer
Set obj = CreateObject("MyCOMServer.object")   
obj.Add (2)