Newbie Q: How to call unmodified VB DLL from Python

Andy Robinson andy at robanal.demon.co.uk
Mon Jun 21 20:03:59 CEST 1999


lull at acm.org (John Lull) wrote:

>As a first Python project, I'd like to use Python (or JPython) to
>automate some hardware testing under Win95/98/NT.  The hardware in
>question is run by a DLL written in VB, and to which I do not have
>source.
>
>"Extending & Embedding the Python interpreter", ch. 3, has
>instructions for building a DLL which will work, but assumes you're
>working in VC++ and have the source.
>
>If anyone could point me toward instructions on how to make this work,
>I'd be grateful.
You need to use Sam Rushing's calldll/windll package at
www.nightmare.com.  This lets you load and call functions in DLLs
dynamically (i.e. without needing a C compiler).  It also provides
python types to emulate C strings and arbitrary memory buffers, so can
call anything.

Needless to say, it is also possible to crash stuff if you get the
arguments wrong, but once set up it works beautifully.  I have been
using it in production round the clock for months now...

Regards,

Andy




More information about the Python-list mailing list