[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] custom tagged_stream_block basetype and swig
From: |
Miklos Maroti |
Subject: |
[Discuss-gnuradio] custom tagged_stream_block basetype and swig |
Date: |
Fri, 28 Jul 2017 18:34:24 -0500 |
Dear All,
For various reasons I am not happy with the tagged_stream_block
implementation, and I have implemented my own version, called
tagged_stream_block2 and put it into my OOT module. I can use the
gr_modtool to create tagged_stream_blocks and manually change the
basetype to my version. Everything seems to work fine, except with
SWIG generated code. There I get undefined references error to virtual
methods (e.g. work). However the C++ code compile fine and no such
error is presented. In fact, before I deleted the build directory and
rebuilt everything even GRC and SWIG was happy after a regular make.
However, once I rebuilt everything with cmake I get these issues in
the SWIG generated code. This is the layout:
tagged_stream_block2.h goes into the include directory and listed in
the CMakeFile.txt
tagged_stream_block2.cc goes into the lib directory and listed in the
CMakeFile.txt
the swig directory CMakeFile is not changed
Can anyone with SWIG expertise help? I have attached the complete error message.
Best,
Miklos
~/workspace/gr-mymodule/build/swig/mymodule_swigPYTHON_wrap.cxx: In
function ‘PyObject* _wrap_new_myblock(PyObject*, PyObject*)’:
~/workspace/gr-mymodule/build/swig/mymodule_swigPYTHON_wrap.cxx:44104:85:
error: invalid new-expression of abstract class type
‘gr::mymodule::myblock’
result = (gr::mymodule::myblock *)new gr::mymodule::myblock();
^
In file included from
~/workspace/gr-mymodule/build/swig/mymodule_swigPYTHON_wrap.cxx:4412:0:
~/workspace/gr-mymodule/include/mymodule/myblock.h:36:20: note:
because the following virtual functions are pure within
‘gr::mymodule::myblock’:
class MYBLOCK_API myblock : virtual public gr::tagged_stream_block2 {
^
In file included from ~/workspace/gr-mymodule/include/mymodule/myblock.h:26:0,
from
~/workspace/gr-mymodule/build/swig/mymodule_swigPYTHON_wrap.cxx:4412:
~/workspace/gr-mymodule/include/mymodule/tagged_stream_block2.h:69:3:
note: virtual int
gr::tagged_stream_block2::calculate_output_stream_length(const
gr_vector_int&)
calculate_output_stream_length(const gr_vector_int &ninput_items) = 0;
^
~/workspace/gr-mymodule/include/mymodule/tagged_stream_block2.h:79:15:
note: virtual int gr::tagged_stream_block2::work(int, gr_vector_int&,
gr_vector_const_void_star&, gr_vector_void_star&)
virtual int work(int noutput_items, gr_vector_int &ninput_items,
^
swig/CMakeFiles/_mymodule_swig.dir/build.make:68: recipe for target
'swig/CMakeFiles/_mymodule_swig.dir/mymodule_swigPYTHON_wrap.cxx.o'
failed
make[2]: *** [swig/CMakeFiles/_mymodule_swig.dir/mymodule_swigPYTHON_wrap.cxx.o]
Error 1
CMakeFiles/Makefile2:237: recipe for target
'swig/CMakeFiles/_mymodule_swig.dir/all' failed
make[1]: *** [swig/CMakeFiles/_mymodule_swig.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
- [Discuss-gnuradio] custom tagged_stream_block basetype and swig,
Miklos Maroti <=