Helloworld with Python C extension
Chris Angelico
rosuav at gmail.com
Mon Aug 29 13:36:10 EDT 2016
On Tue, Aug 30, 2016 at 3:30 AM, Ganesh Pal <ganesh1pal at gmail.com> wrote:
> +char dda_hello(int i)
> + {
> + return string[i];
> + }
> +
> + return Py_BuildValue("s",char1);
Py_BuildValue with an "s" expects a C string - that is, a pointer to
char, not just a single character. You'd need to do something like
this:
char buf[2] = {char1, 0};
return Py_BuildValue("s", buf);
ChrisA
More information about the Python-list
mailing list