This article is in need of a technical review.
The pyxpidl tool suite has been built to replace the older xpidl tool which, in the past, was used to turn XPIDL files into C++ headers and XPCOM typelibs (XPT files). The newer utility has the advantage of not needing any code to be compiled in order to use it, and let us remove a bunch of old code from the tree.
pyxpidl has been in use for a while, but replaced xpidl in the Gecko SDK starting in Gecko 9.0.
pyxpidl is in the SDK in the
sdkdir/sdk/bin/ directory. Unlike xpidl, which combined all the functions into a single utility, pyxpidl is comprised of two utilities:
header.py, which generates C++ headers from IDL, and
typelib.py, which generates XPT files.
pyxpidl requires a directory to cache certain information in. You can use a temporary directory or the current directory or whatever works best for you.
Generating C++ headers
To generate C++ headers, use the
sdkdir/sdk/bin/header.py --cachedir=<path> -o <outputfilename.h> <filename.idl>
Generating typelib files is done using the
sdkdir/sdk/bin/typelib.py --cachedir=<path> -o <oputputfilename.xpt> <filename.idl>
Comparing pyxpidl to xpidl
This table provides a mapping of old
xpidl options to pyxpidl.
|xpidl option||Description||pyxpidl equivalent|
||Emit annotations to typelib||n/a (feature removed)|
||Turn on warnings||n/a (this is now the default and can't be turned off)|
||Verbose mode (NYI)||n/a (feature removed)|
||Creates a typelib of a specific version number||n/a (feature removed, and probably never actually worked)|
||Add an entry to start of include path for
||Specify the base name for output (
||Specify an explicit output file name (
||n/a (this is subsumed by
||Write dependencies (requires -e)||
||Specify output mode||n/a (feature removed; use
It's worth noting that the old output mode options for generating documentation and Java interfaces (
-m doc and
-m java) have no equivalents in pyxpidl.