Am Montag, den 12.05.2008, 23:31 -0700 schrieb Mark Tolonen: > "tuyun" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi > > I have a library written in C, I want to make a python binding for it. > > But I dont know how to get started. > > Is there any guide or document? > > Is "Python/C API Reference Manual" the right doc I need to study first? > > Check out the ctypes library. It comes with Python 2.5, but can be > installed for older versions. > > Here's an example that calls the Win32 function Beep() from kernel32.dll: > > import ctypes > ctypes.windll.kernel32.Beep(440,1000) > > This is a simplistic example that works for simple DLL functions that take > integers and return integers. If your APIs deal with pointers and > read/write buffers it is somewhat more complicated, but still easier to > write your bindings in Python than using the Python C APIs.
Alternativly you might consider using something like cython. Andreas > > -Mark > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor