Dlls
Mike C. Fletcher
mcfletch at vrplumber.com
Sun Feb 18 13:08:22 EST 2007
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?
Hi again, Jason,
As we pointed out to you, ctypes *does* allow you to just load the DLL
and start calling functions. In fact, that's how development tends to
happen in the ctypes implementation. Someone just loads the DLL, hacks
up a demo, I look at it and factor their code into the code-base. If
there's some function missing that you need, do something like this:
from OpenGL.platform import GL
GL.myFunction( myParameter, myOtherParameter )
and if the parameters are of simple types, it will often "just work".
If you want to pass arrays or similar data-types you'll need to make
them ctypes arrays or pointers to use those "raw" functions, but they
should work perfectly well. That is, you have to pass the right
data-type, but then you'd have to do that in assembler too.
Have fun,
Mike
--
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com
More information about the Python-list
mailing list