Hi I am trying to call a c++ function that has the following signature
change_mountain_heights(mnt *mountains,float32 heights,int8 num_elements)
The idea being from python I can have a list of mountains and their heights, and I can call the c++ function to set their heights. The C++ Function takes 2 arrays. An array with the mountain names and another array with the mountain heights.
So in python I have 2 lists
I use ctypes and call the c-function as follows,
mountain_array=(ctypes.c_char_p * len(mountain_list))(*mountain_list)
height_array=(ctypes.c_float * len(height_list))(*height_list)
But it doesn't seem to work, I am not 100% sure if I am creating the array correctly as in both the size and making sure that the mountain strings are properly assigned to the array, similarly for the heights. Am I doing something wrong, or should I look elsewhere for the source of my issue?
I think one of the issues stems from
now the list of mountains is an array of strings, or in python a list of strings, how do I set the argtypes as a list of strings or at least an array of strings.
am I correct in assuming that ctypes.c_char_p which i use in argtypes does NOT allow me to pass into the function an array of strings?. What should i have in argtypes to