pothosware / gr-pothos

Pothos bindings for GNU Radio blocks
https://github.com/pothosware/gr-pothos/wiki
GNU General Public License v3.0
12 stars 1 forks source link

Callable Argument Error Zero MQ Blocks #12

Closed rascustoms closed 5 years ago

rascustoms commented 5 years ago

The GNU Radio Zero MQ blocks do not seem to be able to be wrapped correctly in Pothos.

ZeroMQ Block Error

This is running on Ubuntu 18.04 with Pothos installed from the PPA (0.6.1) and GNU Radio installed from the package manager (3.7.11) .

guruofquality commented 5 years ago

The first issue, the IO type is probably an issue with the parser, it should be coming up with a dropdown of IO sizes in bytes. However you can fix this one and edit the IO type (click the arrow) and enter a number in bytes (2 for short).

The second issue is kind of a bug in gnuradio, it should be using const std::string & or const char * for the address. char * isnt right and its not even the correct type for zeromq socket bind which takes a const char *. @bhilburn @marcusmueller maybe a silly bug worth fixing?

Basically the conversion from std::string to non const char * isnt supported. I made a quick work around patch if you are interested:

diff --git a/GrPothosUtil.py b/GrPothosUtil.py
index 4a2dd89..87532af 100644
--- a/GrPothosUtil.py
+++ b/GrPothosUtil.py
@@ -560,9 +560,9 @@ def splitFactoryParam(factory_param):
     argPass = argName

     #handle special case of const char * input by replacing with std::string
-    if isConstCharStar(typeStr):
+    if isConstCharStar(typeStr) or (typeStr.count('char') == 1 and typeStr.count('*') == 1 and argName == "address"):
         typeStr = typeStr.replace('char', 'std::string').replace('*', '&')
-        argPass = argName + ".c_str()"
+        argPass = "(char *)" + argName + ".c_str()"

     #return c++ type, name of the argument, and code to pass into the factory
     return typeStr, argName, argPass
guruofquality commented 5 years ago

I pushed a fix for both issues, even the awkward work around for the type. I hope the @gnuradio guys can do something about the non-const thing