I'm learning c++ (I've been learning for about 48 hours, so forgive the possible ignorance) for the purpose of speeding up some slow python code. I have written c++ function as follows;
std::tuple<float*, int*, int*, int**> scoreS(int**, float***, int**, float**, float**, float**, float**, float**, float**, float*, float**);
In my python file I do the following;
tmpScoreLib = cdll.LoadLibrary('/ScorerPT2.dll')
tmpScoreLib.ScoreSWrapped.argtypes = [POINTER(POINTER(c_int)), POINTER(POINTER(POINTER(c_float))), POINTER(POINTER(c_int)), POINTER(POINTER(c_float)), POINTER(POINTER(c_float)), POINTER(POINTER(c_float)), POINTER(POINTER(c_float)), POINTER(POINTER(c_float)), POINTER(POINTER(c_float)), POINTER(POINTER(c_float)), POINTER(POINTER(c_float))]
tmpvals1, tmpvals2, tmpvals3, tmpvals4 = tmpScoreLib.ScoreSWrapped(val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,val11)
I use ScoreSWrapped as a wrapper function around the ScoreS function as per this question.
However when I try and run this I get the following error:
ArgumentError: argument 1: <class 'TypeError'>: expected LP_LP_c_long instance instead of list
This is because val1 is a list of lists of floats rather than a pointer to a list of pointers to ints (I assume?) What I can't figure out is how to go from having a list of lists of ints in python to being able to pass the required int** to the c++ function. This is my first foray into this type of c++ wrapper so I could be doing multiple things wrong - assume total ignorance on my part! I have found other questions where they either user ctype.cast or ctypes.byref, but I can't really understand how to apply those.