COM server with [in,out] args how?

Mark Hammond MarkH at ActiveState.com
Thu Apr 26 09:19:08 EDT 2001


Niki Spahiev wrote:

> Hello,
> 
> is it possible to implement in python COM server interface like this:
> 
> spam( [in] short a, [in,out] short * b, [out,retval] BSTR * c )
> 
> all except [in,out] arg works ok.


    Yes.  If you want to implement a true interface (and it sounds like 
you do), you will need a typelib, and use the "win32com.universal" 
module.  Python can't help you create the typelib.

You would implement a method:

def spam(self, a, b):
   return "retval for c", b*a

Only "in" params are presented to Python, and the result is a tuple of 
(retval, out_args, ...)

Mark.




More information about the Python-list mailing list