COM interfacing / "Python Programming on Win32" question

Mark Hammond mhammond at skippinet.com.au
Tue Mar 21 13:33:38 EST 2000


In article <38d3a337.4002925 at news.btx.dtag.de>,
spamfranke at bigfoot.de (Stefan Franke) wrote:
> Finally, I just got my copy of the book (there were obviously some
> distribution problems in Germany). Great work, Mark and Andy!

Thanks!

> Now for my first question: The middle of p. 211 of the book says
> "Python can't support arbitrary COM interfaces; the pythoncom module
> (or a pythoncom extension) must have built-in support for the
> interface.
> Fortunately, there are tools pythoncom developers use that largely
> automate the process of supporting new interfaces"
>
> Do you have any links for those? Or am I missing something in the
> book?
> Right now I'm considering the feasibility of wrapping some selected
> DirectX interfaces for Python. Any help would be appreciated.

We use 2 tools - SWIG and "makegw".  makegw is in the win32com package
(win32com.makegw.makegw).  makegw is a "generate once" tool - it takes
a .h file (as created from an IDL) and outputs .cpp code.  Once
generated, you edit by hand, and can not regenerate without losing the
old version.  makegw can create interfaces and gateways (ie, implement
interfaces and use interfaces).  Stuff like Active Scripting, Active
Debugging etc were done with this tool.

SWIG uses a .i file, and can be continuously tweaked.  However, it can
only generate interfaces - ie, it can use interfaces, but can not
generate code to implement interfaces.  The win32com.mapi support (and
a few others) were done in this way.

You should already have everything you need for makegw.  For swig, you
probably need to go to my starship page and download my customized SWIG
(and also get the latest .i files from cvs)

Mark.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list