Hi Xianda, > I know every block should have it's work or general_work > function.And i know it's used by scheduler. Right! > Now I want to write my c++ code just call work function.Is right to > do it? I hope I understand you correctly: You want to write a C++ program that calls your work function?
As usual, it would be quite helpful if you explained *why* you would want to do this! Short Answer: *Usually* you don't do that, so it's not right to do. Long Answer: You can not generally do this because a block can only exist within GNU Radio, and relies on GNU Radio scheduler mechanisms. If you however, wrote a work() that only uses the the input_items, output_items buffers and only relies on noutput_items as runtime information, than that's technically possible. I would *not* recommend that, though. Better write a new function, e.g. "signal_processing(in,out, howmany)" in a non-block class and call that from your work() as well as from your new C++ program. > If ok,can someone explain how to call work function? It's a C++ method, and the function signature is int work <http://gnuradio.org/doc/doxygen/classgr_1_1sync__block.html#a38942c5d8bee5232404ab71ada9a3956> (int noutput_items, gr_vector_const_void_star <http://gnuradio.org/doc/doxygen/gnuradio-runtime_2include_2gnuradio_2types_8h.html#a9852a3d906d823cb70eb9c29e7f2a43d> &input_items, gr_vector_void_star <http://gnuradio.org/doc/doxygen/gnuradio-runtime_2include_2gnuradio_2types_8h.html#acd3f499576e769966ea44554b359d949> &output_items) (from the official documentation, http://gnuradio.org/doc/doxygen/classgr_1_1sync__block.html) You could call it like you would call every other method. Since I assume you already know how input_ and output_items should look like from writing a work() function, I don't understand where the "how to call question" comes from. Best Regards, Marcus Müller
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio