2

In my OOT module, I have written a function as a "noblock" type, and I would like to import it in GRC.

The compilation process and installation went well, and I am able to use the functions I wrote in python using import my_module as mm and mm.my_python_function().

But this is not working for the one in C++ and I have error message :

Param - Value(value): Value "my_module.my_cpp_function()" cannot be evaluated: 'module' object has no attribute 'my_cpp_function'

What I am missing please ? Does this have anything to do with swig ? How to set it up ? Thank you.

Note : I am running Ubuntu 14.04 and GRC have been installed using PyBombs with prefix = /usr/local

1 Answers1

0

It sounds like you are close and that swig is set up correctly. I've been fighting this for the past 2 days and have come up with an approach I think mimics what is done in gr-digital. However, before I spell it all out, have you tried adding an "Import" block to GRC and then entering "import my_module" as its "Import"?

I kind of assume so since you were able to import and use the module in python.

Did you create something like swig/my_module.i? Follow gr-digital/swig/packet_header.i as a template. Then make sure that swig/CMakeLists.txt includes my_module.i in the install() statement at the end; again, look at gr-digital/swig/CMakeLists.txt for guidance.

Last, make sure your swig/_swig.i includes

#include "<module_name>/my_module.h"

and later

%include "<module_name>/my_module.h"

at the end of the file

%include "my_module.i"

Again, see gr-digital/swig/digital_swig.i for examples using packet_header.

eeKnud
  • 96
  • 8