2011-01-05 16 views
3

私がしようとしているのは、アプリケーションAがアプリケーションが共有メモリに(boost :: interprocessを使って)割り当てたオブジェクトへのポインタを送ることです。そのポインタの転送のために私はboost::interprocess::message_queueを使用するつもりです。明らかに、Aからのダイレクト・ロー・ポインターはBで有効ではないので、共有メモリーに割り当てられたoffset_ptrを転送しようとします。しかし、それも動作していないようです。私はそれを見るように、この方法ではプロセスで彼を無効にオフセットポインタのビットのコピーを行い、boost :: interprocess :: message_queueを通してポインタを転送する

// Create a "buffer" on this side of the queue 
MyVectorPtr * myvector; 
myvector = segment->construct<MyVectorPtr>(boost::interprocess::anonymous_instance)(); 
mq->receive(myvector, sizeof(MyVectorPtr), recvd_size, priority); 

typedef offset_ptr<MyVector> MyVectorPtr; 
MyVectorPtr * myvector;  
myvector = segment->construct<MyVectorPtr>(boost::interprocess::anonymous_instance)(); 

*myvector = segment->construct<MyVector>(boost::interprocess::anonymous_instance) 
     (*alloc_inst_vec); ; 

// myvector gets filled with data here 

//Send on the message queue 
mq->send(myvector, sizeof(MyVectorPtr), 0); 

プロセスBがこれを行う:Aはこの行い

プロセスB.これをどうすればいいですか?

答えて

0

ブーストメーリングリストのthis postに記載されているように対処できるようです。

関連する問題