PyVariant anyone

Andrew MacIntyre andymac at bullseye.apana.org.au
Mon Jul 14 12:25:05 CEST 2003


[posted & mailed]
On Mon, 14 Jul 2003, Paul Keating wrote:

> I need to call a C++ DLL from Python, for which I'm planning to use
> boost.python. But the DLL has been written to a VBA interface, and this
> means it expects to get variable length arrays as Windows Variants instead
> of lists or tuples.
>
> Anyone know how to construct a convincing Windows Variant in Python?

I've been able to do so with Thomas Heller's ctypes module, but I've not
got as far as dealing with arrays.

However, if you're going to use boost.python then I'd infer that you're
already using some C++ so it would be much easier to do the conversion at
the C++ interface level - my understanding is that a VARIANT is a C
structure, which for arrays points at another structure, which in turn
gives the number & type  of elements and a pointer to the actual
calloc()ed array data.

--
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  (pref) | Snail: PO Box 370
        andymac at pcug.org.au             (alt) |        Belconnen  ACT  2616
Web:    http://www.andymac.org/               |        Australia





More information about the Python-list mailing list