Help on ctypes.POINTER for Python array

Jim Schwartz jschwar at sbcglobal.net
Thu May 11 11:15:47 EDT 2023


I’m not sure this is the shortest method, but you could set up two python scripts to do the same thing and convert them to c using cython. I wouldn’t be able to read the c scripts, but maybe you could. 

Maybe someone else has a more direct answer. 

Sent from my iPhone

> On May 11, 2023, at 10:00 AM, Jason Qian via Python-list <python-list at python.org> wrote:
> 
> Hi,
> 
> Need some help,
> 
> in the Python, I have a array of string
> 
> var_array=["Opt1=DG","Opt1=DG2"]
> 
> I need to call c library and  pass var_array as parameter
> 
> In the   argtypes,  how do I set up ctypes.POINTER(???)  for var_array?
> 
> func.argtypes=[ctypes.c_void_p,ctypes.c_int, ctypes.POINTER(????)]
> 
> In the c code:
> 
> int  func (void* obj, int index,  char** opt)
> 
> Thanks
> Jason
> -- 
> https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list