Easiest way to access C module in Python

bartc bc at freeuk.com
Tue Nov 7 06:53:44 EST 2017


On 07/11/2017 11:35, Paul Moore wrote:
> On 7 November 2017 at 11:16, Chris Angelico <rosuav at gmail.com> wrote:
>> Thanks for the FUD. I love it when someone, on the basis of one failed
>> experiment, trash-talks an excellent piece of software that would
>> solve the OP's problem.
> 
> It *is* true that the learning curve for Cython is steeper than that
> of ctypes. But for anything more complex than simple "call a function
> with no arguments", ctypes rapidly gets fairly complex and messy - and
> the docs are not exactly the best. At that point, investing the time
> in learning how to use Cython definitely pays off.

But just staying with the "function with no arguments" for the minute 
(the equivalent of Hello World for this exercise), how would it be done 
in Cython? Would a working example be simple enough to show in a usenet 
post?

> Another option for the OP is cffi,

And perhaps another example here.

(cffi doesn't seem to be part of any of my pythons, so that would be an 
obstacle for me as installing extra stuff rarely seems to work. Having 
said that, I located pip.exe, trying typing 'pip install cffi' and it 
seemed to be doing something but then failed with a bunch of errors.)

-- 
bartc



More information about the Python-list mailing list