Python -COMMETHOD ,No return value obtained/received


S

sanju dhoomakethu

I am very new to COM programming, Our project requires the Python script to make communication with a COM dll which is written in C#.

The generated COM signature in Python is as below

COMMETHOD([dispid(1610743820)], HRESULT, 'test',
( ['in', 'out'], POINTER(_midlSAFEARRAY(c_double)), 'test' ),
( ['retval', 'out'], POINTER(VARIANT_BOOL), 'pRetVal' )),
Where as the C# code for the same is

public bool test(ref double[,] test)
{
if (test == null)
test = new double[1,2];


test[0,0] = 0.0;
test[0,1] = 0.5;

return true;
}
Note: the above is the dummy functions i have created to explain the issue

Now when I try to invoke the COM method from Python , I am only getting the values passed by reference to the method (sweepValuesX) as return value and not the actual return value (which has to be either true/false)

My function call is as below

print apxWrapper.test()
and the output is ((0.0, 0.5),)

Note: Since i was not able to find a way to pass the last arguement from Python ,I just omitted the last argument for trial purpose

Any hints why this is happening is highly appreciated or to be specific I have two questions

1> How Can i pass the argument to be passed by reference from Python especially array (both single and multidimensional)(POINTER(_midlSAFEARRAY(c_double)))
2> How can i get the actual return value (true/false)
Sanjay
 
Ad

Advertisements


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

Top