[python-win32] signature for call COM interface

Jens B. Jorgensen jens.jorgensen at tallan.com
Thu Sep 2 15:37:20 CEST 2004


If that's truly what the IDL looks like then your interface is not 
Automation compatible, that's for sure. Additionally (and I really am 
not sure at all on this), I'm not sure that it will even work with 
makepy though this is just a guess. A better bet might be to try your 
luck with the ctypes module. The COM stuff there is officially "work in 
progress" but I've been able to use it successfully a couple of times.

http://starship.python.net/crew/theller/ctypes/

BTW, if you have the option of modifying the COM interface there is an 
Automation-compatible way of having an array of bytes. You can use a 
SAFEARRAY of uchar. They are a little bit more of a pain to use but that 
will make them work nicely with scripting languages, etc.

Your last option, one that people are ever-reluctant to do, is to write 
a custom python extension that wraps it. This is so easy to do (well, 
certainly compared to perl if you're doing it by hand and by this I am 
specifically ruling out SWIG) if you're comfortable with C. There are 
even tools that will generate a whole C skeleton for you out there 
though it's been a while since I've used one. The python tutorial can 
guide you through this quite well.

Lin Jingxian wrote:

> hi,
>     I use python test my COM interface, there has a method like:
>   int read([in] unsigned char* buf,[in] int len)
>  
> what's the signature for python to call this method?
> thanks.
>  
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Python-win32 mailing list
>Python-win32 at python.org
>http://mail.python.org/mailman/listinfo/python-win32
>  
>


-- 
Jens B. Jorgensen
jens.jorgensen at tallan.com

"With a focused commitment to our clients and our people, we deliver value through customized technology solutions"  



More information about the Python-win32 mailing list