[Discuss-gnuradio] Public method in out of tree module
From:
Dirk Van Bruggen
Subject:
[Discuss-gnuradio] Public method in out of tree module
Date:
Fri, 22 Nov 2013 10:51:22 -0500
Hello,
I am trying to create a block that has a publicly accessible method and am having trouble accessing the method from within Python. Here is a simple example of my process.
First, I boot Gnuradio Live DVD, Ubutnu 12.04, Gnuradio 3.7.2
> gr_modtool newmod testmod > cd gr-testmod > gr_modtool add -t general testblock (empty argument list, default answers) > vim lib/testblock_impl.cc (Edit this to the same as the square_ff.cc code from the example) > mkdir build > cd build > cmake ../ > make > sudo make install > sudo ldconfig
This works fine, I can verify the block is working correctly.
Then I edit the public header file to add a pure virtual method pub()
Then I edit the private header file to implement the method
> ..... > public: > int pub(){ return 1; } > ....
If I build this, it will make and install just fine. The only problem comes when I run python like so
> import testmod > b = testmod.testblock() > b.pub()
I get the following error:
> AttributeError: 'testblock_sptr' object has no attribute 'pub'
I've tried following the examples of in tree blocks, but just cannot seem to be able to access pub() from python. Am I missing an include, or something?