python - dll access (ctypes or swig)
claird at lairds.us
Wed Apr 18 05:55:38 CEST 2007
In article <mailman.6640.1176846203.32031.python-list at python.org>,
Larry Bates <larry.bates at websafe.com> wrote:
>Daniel Watrous wrote:
>> I am interested in using python to script access to some hardware for
>> which there are existing drivers in the form of DLLs. The DLLs each
>> have four exported functions and a host of COM Properties and COM
>> Methods. The four exported functions are as follows:
>> The COM methods and properties all begin with I, followed by a unique name.
>> I am able to load the DLL using ctypes and it can access the exported
>> functions, but I'm not sure how to access the COM methods and
>> properties. I have read that ctypes once had support for COM but that
>> it has since been separated into its own project. I couldn't find any
>> information about how these work together.
>> All help is appreciated. THANKS in advance...
>I recently learned that you can ship COM as either an .EXE or a .DLL (nobody
>has yet let me know why). You don't have a traditional .DLL that you would
>use ctypes to call methods in, you have a COM .DLL. COM methods need to be
>access with Win32com
>You need to find out the COM dispatch typelib name and make sure the DLL is
>registered (regsvr32 your.dll).
Is this--adroit use of Win32com with special-purpose DLLs--written
up anywhere? Doing this with unusual hardware that turns up in the
real world is ENTIRELY more satisfying than trying to wrangle the
Visual C bindings that vendors usually push, but, apart from Mark
and Andy's book, now over seven years old, I know of no appropri-
ately ambitious tutorial in the subject.
Daniel, do you have what you need to make progress? Have you seen
<URL: http://www.oreilly.com/catalog/pythonwin32/ >?
More information about the Python-list