I have a C/C++ dll with a function:
int get_camera_info(char * description, char * serial_number, char * manufacturer)
This function takes the arguments and modifies them, so that you could print them. I'm trying to use this DLL from Python by using ctypes
. I guess I would need to use ctypes.create_string_buffer
to create an empty buffer so that I have a mutable object. But then, how do I do so that I can pass it as an argument and then retrieve the data?
Do I need to use cast(buffer_object, c_char_p_object)
? How would this be any different from creating and passing a c_char_p
object in the first place? I don't know much about C/C++, but maybe I should be using ctypes.POINTER
.
My problem was that after passing a c_char_p
type object as an argument I'm getting the error: OSError: exception: access violation reading 0x00000000
.
If you need any help trying to understand what my question is, just ask. Or if you think I'm better off using something like cppyy, then I would need help with that too. :)