On Mon, Aug 06, 2007 at 12:13:51PM -0700, Hans Glitsch wrote:
> Hello,
>
> Please help me. I'm having a lot of trouble understanding the make files
> to build gnuradio and the makefiles I use to build my own gnuradio blocks.
> Also, swig hates me and I hate it. So far I've had no trouble building
> gnuradio and building my own blocks by delicately modifying an example
> build tree, but now I want to do something a little different.
>
> I want the python code to make an instance of the usrp1.source_c object and
> pass it into C++ by calling this function:
> void run_radio( usrp1_source_c_sptr usrp );
>
> I added this function and it's definition to one of my cc files and added
> the declaration to the swig i file for my blocks, and everything builds
> properly.
>
> In the python I create the usrp object with:
> adc = usrp.source_c(0,250, fpga_filename="std_4rx_0tx.rbf")
> then later call the new function with:
> sm.run_radio( adc._u )
>
> When python executes the last line it throws an exception:
> "TypeError: in method 'run_radio', argument 1 of type 'usrp1_source_sptr'"
> My question is, what type should the parameter be in the run_radio
> function? How do I get swig to correctly marshal this smart pointer back to
> c++?
I think it should be:
usrp1_source_c_sptr
I think your sm.i file will need to:
%import "usrp1.i" // N.B., not %include
to pick up the right types.
There's a chance you'll have to add the following three lines in
front of the %import, but I'm not sure off the top of my head.
%{
#include "usrp1_source_c.h"
%}
> Thanks for the help,
> Hans
You're welcome!
Eric
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio