PEP 245

Alex Shindich shindich at itginc.com
Wed Apr 4 16:39:35 EDT 2001


I am writing this message in an attempt to undo the damage that the recent
discussion about COM caused, as I believe that some members of the Python
community may have been led to false conclusions about the COM technology.

First of all, I would like to apologize for any false COM-related statements
made by me. At no point in time did I intend to educate anyone about COM,
nor did I intend to explain anyone how the COM technology works. Again, if
my statements caused confusion, I sincerely apologize for that.

Second of all, I would like to encourage people interested in learning more
about COM to take everything said in this thread with a great deal of
caution, and instead read one of the following books:
	1. Inside COM, by Dale Rogerson
		Amazon Link:
http://www.amazon.com/exec/obidos/ASIN/1572313498/o/qid=986414511/sr=8-1/ref
=aps_sr_b_1_1/107-6092622-0166935
	2. Essential COM, by Don Box -- My personal favorite
		Amazon Link:
http://www.amazon.com/exec/obidos/ASIN/0201634465/qid=986414619/sr=1-1/ref=s
c_b_2/107-6092622-0166935
	3. Effective COM: 50 Ways to Improve Your COM and MTS-based Applications,
by Don Box, Keith Brown, Tim Ewald, Chris Sells -- This book talks about
more advanced topics
		Amazon Link:
http://www.amazon.com/exec/obidos/ASIN/0201379686/qid=986414768/sr=1-4/ref=s
c_b_5/107-6092622-0166935

Why do I recommend to take the recent conversation wit a great deal of
caution? For a very simple reason. I made certain misleading statements
about COM. For instance, I said that "COM components can be written using
anything that is capable of creating C++-compatible virtual tables." That
statement was only partially true, and Mr. Martelli was kind enough to
correct me. He said: "(Not quite -- the methods in the almost-virtual-tables
of COM need to use calling-convention __stdcall, with 'this' aka 'self' as
the first [implicit] argument on the stack, while C++ compilers for Win32
platforms, depending on their brand, normally use __fastcall [arguments in
registers] or else __thiscall ['this' aka 'self' in the CX register], for
example -- a minor issue, but let's not spread _further_ misinformation
about COM, shall we:-)." And his comment was quite valid. He was also
correct explaining that one of the reasons for using __stdcall convention is
to standardize on how parameters are being passed into the methods. Except
that he did not explain the whole picture. For instance he omitted the fact
that __stdcall convention requires that a function being called removes the
parameters from the stack before the function returns. This is as important
of a requirement as the mechanism of passing parameters, i.e. one cannot
create COM-compatible interfaces if the functions implementing interface
methods do not clean up the stack before returning from the call. From
reading Mr. Martelli's comment one may have been misled about the meaning of
the __stdcall calling convention.
ATTENTION: I did not list all the other restrictions associated with
__stdcall. For detailed information search for "__stdcall" on MSDN.

While the issue I pointed out is not very significant in itself, it shows
that even such trust-worthy community members as Mr. Martelli do not always
provide complete information. And therefore it is better to read books.

Sincerely,

Alex Shindich





More information about the Python-list mailing list