Jason Ward wrote: > Hi. I am interested to know why python can't access DLL files directly. > It seems to me that because python can't access DLL's directly we have to > waste our time and write wrappers around libraries that have already > been written. > > So if the python developers were to implement say this. > > import MYDLL.dll > > Then we would be able to do everything with that library that we can do > in other languages. > > For eg. I want to use PyOpenGL. But the problem is the library hasn't > got all the opengl functions implemented. > So I can either develop quickly with an incomplete library or develop > slowly in assembler. > I mean really, in asm we just call the dll function directly. > > Why must python be different? > That's a bit like asking why you can't put the engine from a BMW into an Audi. The answer is, of course, that you can - it just required a lot of work to adapt the engine to a foreign environment.
You might be interested in the ctypes module - see http://docs.python.org/lib/module-ctypes.html That does more or less what you are asking for, but you can't expect to be able to call arbitrary functions written in one language from another - there's just too much variability in the way that data are represented in different languages. There are, of course, systems like mono (.NET) that provide compilers for multiple languages with the specific goal of interoperability, but in general there will be an "impedance mismatch" that you will need to code around. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden Blog of Note: http://holdenweb.blogspot.com See you at PyCon? http://us.pycon.org/TX2007 -- http://mail.python.org/mailman/listinfo/python-list