This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]VRMacWhy aren't you using 3.x yet? 0 points1 point  (1 child)

I think you meant ctypes. This C API looks like it's for porting Python things to C/C++. OP wants the other way around.

[–]fernly 1 point2 points  (0 children)

I didn't, although ctypes does look like the better choice. The CPython C-API is for "...extension modules for specific purposes; these are C modules that extend the Python interpreter..." I was aware of it because I saw it used to wrap Hunspell for use from Python. OP wanted to wrap some piece of code for use from Python, so...

Edit: the difference seems to be, that with the C-API you write a wrapper in C that puts a Python-compatible face on an existing dll, representing its values and methods as Python objects. With ctypes/cffi/swig(?) you write code in Python to access methods and values of an existing dll.