I've a dynamic C library (say foo.so) in which there's a function having the following prototype
wchar_t **foo(const char *);
/*
The structure of the return value is a NULL terminated (wchar_t **),
each of which is also NULL terminated (wchar_t *) strings
*/
Now I want to call the function through this API from python using ctypes module
Here's the snippet I've tried with :
from ctypes import *
lib = CDLL("foo.so")
text = c_char_p("a.bcd.ef")
ret = POINTER(c_wchar_p)
ret = lib.foo(text)
print ret[0]
But it's showing the following error :
Traceback (most recent call last):
File "./src/test.py", line 8, in
print ret[0]
TypeError: 'int' object has no attribute '_ _ getitem _ _'
Any help to get things going in python is keenly appreciable.
P.S : I've cross checked the functionality of foo("a.bcd.ef") in a sample C code & this is what the return pointer looks like