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.

Using pyxpidl

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:, which generates C++ headers from IDL, and, 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 utility:

sdkdir/sdk/bin/ --cachedir=<path> -o <outputfilename.h> <filename.idl>

Generating typelibs

Generating typelib files is done using the utility:

sdkdir/sdk/bin/ --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
-a Emit annotations to typelib n/a (feature removed)
-w Turn on warnings n/a (this is now the default and can't be turned off)
-v Verbose mode (NYI) n/a (feature removed)
-t Creates a typelib of a specific version number n/a (feature removed, and probably never actually worked)
-I Add an entry to start of include path for #include "nsIFoo.idl" -I (unchanged)
-o Specify the base name for output (-o /tmp/nsIFoo for example) -o outputfile (this isn't just the base name, but needs to include the extension; for example -o /tmp/nsIFoo.idl)
-e Specify an explicit output file name (-e /tmp/nsIFoo.idl for example) n/a (this is subsumed by -o now)
-d Write dependencies (requires -e) -d (unchanged)
-m Specify output mode n/a (feature removed; use or specifically)

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.

See also

Document Tags and Contributors

 Contributors to this page: fscholz, kscarfone, Sheppy, khuey
 Last updated by: fscholz,