Does python have the capability for driver development ?

Michael Torrie torriem at gmail.com
Thu Jul 30 13:30:03 EDT 2009


MalC0de wrote:
> please introduce me some resource for system programming, I know that
> python is very well at system programming level.
> thanks

Although it is possible (as others have said) to embed Python the
interpreter into a driver, no one has done that that I know of.  You'd
have to write the driver in C or C++, though, and then provide embed a
python interpreter and then provide a python interface (wrapper code
written in C++) that would expose binary primitives and structures to
python that the OS and driver use.  Sounds like quite an undertaking.  I
embedded a python interpreter in a gina dll once (to write login code in
python).  That's a form of system programming, but not what you're
asking about.

Someone years ago someone embedded the perl interpreter into a Linux
driver allowing some kinds of device drivers to be written in perl.  It
was made more as a curiosity though.

Python is not well-suited to system programming.  It takes extra work
(via the ctypes library or other wrappers) to interface with C structs,
plus calls all have to be marshalled to and from the native C APIs.
Might be cool, though.

System programming in Win32 is very complicated and messy.  What little
system programming I've done in Linux was a dream compared.  Definitely
you'll have to master win32 system programming in C and C++ before you
try to embed python in anything.  I'm sure there are a number of books
on the subject.  That's where I'd start.



More information about the Python-list mailing list