Running Cython in Windows x64 – fatal error C1083: Cannot open include file: ‘basetsd.h’: No such file or directory

In case anyone is currently (2017) facing same error with visual C++ 2015 tools, launch setup again and also select windows 8.1 / 10 SDK depending upon your OS. This will fix basestd.h error. If it is still not working, try launching build tools from: C:\Program Files (x86)\Microsoft Visual C++ Build Tools. Another alternative would … Read more

Create an object using Python’s C API

Call PyObject_New(), followed by PyObject_Init(). EDIT: The best way is to call the class object, just like in Python itself: /* Pass two arguments, a string and an int. */ PyObject *argList = Py_BuildValue(“si”, “hello”, 42); /* Call the class object. */ PyObject *obj = PyObject_CallObject((PyObject *) &pyfoo_T, argList); /* Release the argument list. */ … Read more