PyVariant anyone

P

Paul Keating

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?
 
A

Andrew MacIntyre

[posted & mailed]
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.
 
M

Mark Hammond

Paul said:
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?

If you can link against pythoncom.dll, there are public functions there
for it.

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,139
Messages
2,570,805
Members
47,356
Latest member
Tommyhotly

Latest Threads

Top