call by reference from automation objects
yves
yves_breemersch at hotmail.com
Mon Sep 2 09:53:39 EDT 2002
Hello,
I have an automation object generated from VC6:
BEGIN_DISPATCH_MAP(CSNMPManager, CCmdTarget)
//{{AFX_DISPATCH_MAP(CSNMPManager)
DISP_FUNCTION(CSNMPManager, "Get", Get, VT_I4, VTS_I4 VTS_VARIANT
VTS_VARIANT)
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
long CSNMPManager::Get(long RID, const VARIANT FAR& OIDs, const
VARIANT FAR& Result)
{
...
PerformGet(RID, vaSNMPObject, vaValues, lErrorCode);
// Copy the result
vaDetachedValues = vaValues.Detach();
VariantClear(Result.pvarVal);
Result.pvarVal->vt = vaDetachedValues.vt;
Result.pvarVal->parray = vaDetachedValues.parray;
lRetVal = lErrorCode;
return lRetVal;
}
My Python script is loaded as code file from my C++ application and
the appropriate IDispatch pointers are supplied to the script to be
able to call the object.
When I call the method from Python the result lst stays empty:
lst=()
lstMIBObjects=["1.3.6.1.2.1.2.2.1.10.1",]
lRetval=Snmp.Manager.Get(557848457, lstMIBObjects, lst)
lst is an empty tuple although the safearray contains actual values.
As I understand it Python does not support call by reference and
parameters that are changed within a method should be returned as
multiple return values.
Does this also applies to methods called from automation objects and
do I have to encapsulate multiple return values in a safearray?
kind regards
yves
More information about the Python-list
mailing list