[Tutor] Accessing a DLL from python

Stefan Behnel stefan_ml at behnel.de
Tue Mar 1 13:53:08 CET 2011


Hanlie Pretorius, 01.03.2011 13:33:
> Can anyone perhaps suggest the easiest way of translating the C code
> into Python, bearing in mind that I'm rather a beginner?

A beginner of what? Python? Programming in general?

The C code you posted doesn't look too complex, so you could try to 
translate it (mostly literally) into Python syntax and use Cython to wrap 
that in a binary extension.

Cython is basically Python, but it allows you to call directly into C code. 
Here's a tutorial:

http://docs.cython.org/src/tutorial/clibraries.html

Stefan



More information about the Tutor mailing list