Weave is a python module that includes a method of including C and C++ code inline with python. Has a slightly bigger overhead than the swig approach but is a lot easier to implement. And the code can be any dynamically created string. For example this block of python code calculates the fixed point multiplication of var1 and var2. The code is modified from a matlab algorithm worked on during my summer internship at Tait Electronics . from scipy.weave import inline as inlineC r = rounding and 1 or 0 # Blatent hack to convert from pythons True/False to 1/0 for C/C++ exp = """ signed int K,result; signed long int temp; temp = (long int)var1 * (long int)var2; signed int sign = temp/abs(temp); if(r) { K = 1 > numBits); if(result > fp_Max){ result = fp_Max; } if(result result = inlineC(exp,[ 'var1' , 'var2' , 'numBits' , 'fp_Min' , 'fp_Max' , 'r' ]...
Ramblings about developing software. May contain traces of Java, Python, Scala, Typescript.