Calling DLLs from Python [Windows]
Brian Elmegaard
brian at rk-speed-rugby.dk
Wed Oct 8 05:39:26 EDT 2003
"Georgy Pruss" <SEE_AT_THE_END at hotmail.com> writes:
> How can I call a function which is in a Windows DLL? For example,
ctypes is your friend
from ctypes import *
If you have t.dll exporting INCREMENT
# load dll
inc = windll.LoadLibrary("t.dll")
# Initiate c-variable for the dll
n=c_int(1)
# Call the dll one
inc.INCREMENT(byref(n))
print "The integer is now: %d" % n.value
# And a few times more:
for i in range(5):
inc.INCREMENT(byref(n))
print "The square of the integer is now: %d" % n.value**2
> Google didn't help on this.
???????
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=utf-8&safe=off&q=external+dll+python&btnG=Google+Search
--
Brian (remove the sport for mail)
http://www.et.dtu.dk/staff/be
More information about the Python-list
mailing list