# Gnuradio message passing

**URL:** <https://www.ruby-forum.com/t/gnuradio-message-passing/238686>\
**Category:** GNU Radio\
**Created:** [January 23, 2014, 2:25pm UTC](https://www.ruby-forum.com/t/gnuradio-message-passing/238686 "2014-01-23T14:25:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [January 23, 2014, 2:25pm UTC](https://www.ruby-forum.com/t/gnuradio-message-passing/238686/1 "2014-01-23T14:25:40Z")

</div>

Message passing is described in web site. I do not know where to put  
codes in  
c++ sync blocks. Can you please explain how to implement message passing  
with  
example. Do we need for loop in work function. How to return  
noutput\_items.  
Thanks  
Neil  
And another thing. How to remove inserted GRC cusome module from GRC.

---

<div class="post-metadata">

**Author:** ![MHMND\_Herath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecccb3/32.png) [@MHMND\_Herath](https://www.ruby-forum.com/u/MHMND_Herath)\
**Post date:** [January 23, 2014, 6:50pm UTC](https://www.ruby-forum.com/t/gnuradio-message-passing/238686/2 "2014-01-23T18:50:48Z")

</div>

Hi,

message passing is implemented asynchronously by binding functions to  
message ports.  
[1] is the page that explains message ports in great detail.  
So first you declare your message ports preferably in your blocks  
constructor.  
Than you bind one of your functions to an incoming message port. The  
functions parameter has to be a pmt::pmt\_t.  
Everytime a message is published to this port, this function will be  
called.  
For outgoing message ports, you just generate your pmt object and call  
the  
publish method.  
Exact method names etc. are explained on the GNU Radio manual page.

happy hacking  
Johannes

[1] [http://gnuradio.org/doc/doxygen/page\_msg\_passing.html](http://gnuradio.org/doc/doxygen/page_msg_passing.html)
