I am trying to wrap a function written in C such that I can access it in Python using SWIG
The problem I have is that it expects a pointer to a pointer to a struct, not a pointer to a struct, e.g.
int update_tracks(track_t **hash_tracks);
if it were:
int update_tracks(track_t *hash_tracks);
I would have no problem as I can create the argument and call the function from python as follows:
hash_tracks = track_t()
n = update_tracks(hash_tracks)
track_t is a simple C struct containing some ints, floats, arrays etc.
but I can't figure out how to get the pointer to hash_tracks that I need as the argument to the first function (i.e. the one I am actually trying to wrap)
The reason I need a track_t** argument (not just a track_t* argument) is that hash_tracks is a hash-table (using the uthash library) and as such the pointer to the track table can change as the function adds and removes track_t structs within its implementation.
I am stumped how to call such a function from python. Maybe I need to implement some 'helper' functions in C or use some SWIG typemaps to make it possible?