### Module win32com.makegw.makegw - Utility functions for writing out gateway C++ files

## SYNOPSIS

    # Parent Module
    win32com.makegw

    # Functions
    make_framework_support  # Generate C++ code for a Python Interface and Gateway

## DESCRIPTION

This module will generate a C++/Python binding for a specific COM interface.

At this stage, no command line interface exists. You must start Python, import this module, change to the directory where the generated code should be written, and run the public function.

This module is capable of generating both `Interfaces` (ie, Python client side support for the interface) and `Gateways` (ie, Python server side support for the interface). Many COM interfaces are useful both as Client and Server. Other interfaces, however, really only make sense to implement one side or the other. For example, it would be pointless for Python to implement Server side for `IRunningObjectTable` , unless we were implementing core COM for an operating system in Python (hey - now there's an idea!)

Most COM interface code is totally boiler-plate - it consists of converting arguments, dispatching the call to Python, and processing any result values.

This module automates the generation of such code. It has the ability to parse a .H file generated by the MIDL tool (ie, almost all COM .h files) and build almost totally complete C++ code.

The module understands some of the well known data types, and how to convert them. There are only a couple of places where hand-editing is necessary, as detailed below:

unsupported types
  If a type is not known, the generator will pretty much ignore it, but write a comment to the generated code. You may want to add custom support for this type. In some cases, C++ compile errors will result. These are intentional - generating code to remove these errors would imply a false sense of security that the generator has done the right thing.
other return policies
  By default, Python never sees the return SCODE from a COM function. The interface usually returns None if OK, else a COM exception if "FAILED(scode)" is TRUE. You may need to change this if: * EXCEPINFO is passed to the COM function. This is not detected and handled * For some reason Python should always see the result SCODE, even if it did fail or succeed. For example, some functions return a BOOLEAN result in the SCODE, meaning Python should always see it. * FAILED(scode) for the interface still has valid data to return (by default, the code generated does not process the return values, and raise an exception to Python/COM

Copyright © Greg Stein, Mark Hammond, Curt Hagenlocher and a few other contributors
All Rights Reserved
Comments to author:
Generated: Sun Apr 20 1997