COM, Recieve by reference

Steve Allison sallison at netcomuk.co.uk
Fri Sep 14 12:29:06 EDT 2001


Hi,
I'm just starting out to investigate whether Python is a good choice
of language for COM development.  One problem I have come across is
how to pass variables into Python COM servers by reference.  For
instance, in C++ I can have a COM server with a method like:

int MyComServer::foo(int* x, int* y) {
  *x = 21;
  *y = 64;
  return OK;
}

so the COM client's x and y variables are set to 21 and 64
respectively.  I can't see how this can be achieved in Python.  As I
understand it the following:

class MyComServer:
 <snip COM bookeeping)>
 def foo(self, x, y):
   x = 21
   y = 64

simply creates local copies of x and y and so teh callers copy of
those variables is left unset.  Is there a way of having a Python COM
server recieve and use variables passed by reference?

Thanks for any help

Steve.



More information about the Python-list mailing list