I'm using a 3rd-party C++ library (exporting a typelib via COM) from Python via the comtypes module.
One of the available calls defines an OUT parameter, like so:
COMMETHOD([helpstring(u'method GetPacket')], HRESULT, 'GetPacket',
( ['in'], comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0.GUID, 'guid' ),
( ['in'], c_int, 'lSize' ),
( ['out'], POINTER(c_ubyte), 'pData' )),
The C++ example code provided by the library's author initializes pData to be a byte array of length lSize before invoking GetPacket(), like so:
pPacket = new BYTE[lSize];
HRESULT hr = pData->GetPacket(guid, lSize, pPacket);
However, the comtypes library for Python doesn't provide a way to pass an initial value for pData -- and, on calling the library with no initial value, the interpreter promptly segfaults.
Is it possible to interoperate with this library from Python -- ideally, from comtypes?