This is an archived page. It's not actively maintained.

xpidl is a tool for generating XPCOM interface information, based on XPIDL interface description files. It generates:

  • C++ header files (.h), with a commented template for full C++ implementation of the interface
  • XPConnect typelib files (.xpt), with runtime type information to dynamically call XPCOM objects through XPConnect

Note: Starting in Gecko 9.0, xpidl has been replaced with pyxpidl in the Gecko SDK. pyxpidl has been used for some time now, but now this older tool has been fully retired.

xpidl is based on the libIDL idl compiler from the Gnome project. The libIDL compiler depends on glib, also from the Gnome project. The xpidl compiler is now part of the build process, allowing us to generate headers used by the XPCOM components. Please check the Build Documentation for further information on where to get libIDL and glib.

Using xpidl

To add an IDL file to the build, use the XPIDLSRCS makefile variable. For testing purposes, or one-off interface compilation, xpidl can be run from the command line:

Usage: ./xpidl -m mode [-w] [-v] [-t version number] [-d filename.pp]
          [-I path] [-o basename | -e filename.ext] filename.idl
       -a emit annotations to typelib
       -w turn on warnings (recommended)
       -v verbose mode (NYI)
       -t create a typelib of a specific version number
       -I add entry to start of include path for ``#include "nsIThing.idl"
       -o use basename (e.g. ``/tmp/nsIThing) for output
       -e use explicit output filename
       -d write dependencies (requires -e)
       -m specify output mode:
          header        Generate C++ header            (.h)
          typelib       Generate XPConnect typelib     (.xpt)
          doc           Generate HTML documentation    (.html)
          java          Generate Java interface        (.java)