Calling Function in DLL on Windows
Ken Seehof
12klat at sightreader.com
Thu Jun 1 01:24:30 EDT 2000
dsavitsk wrote:
> i need to call a DLL from within a python program. in VB i would declare the
> function like...
>
> Declare Function LoadSFW Lib "Sfwlnk32" (ByVal strPath As String, ByVal
> strConfig As String) As Long
>
> then use it later like...
>
> intErrorCode = LoadSFW("C:\SFW", 6)
>
> i don't know how to do this in Python, so any quick explanation would be
> helpful.
>
> doug
I don't know of any easy way to do it. The hard way to do it would be to
write an extension module that wraps your DLL function(s). If you don't
know how to do this, read about "Extending Python". If you don't know
C or C++, I'm afraid you are probably out of luck until someone implements
a generic solution....
Here's an interesting project for Windows programmers: Write a general
purpose DLL caller. Functions should be declared in python (like in VB)
and the DLL should be accessible from python without requiring the user
to write any C code. This is doable (VB does it). The hard part will be
converting the DLL function arguments.
- Ken Seehof
More information about the Python-list
mailing list