xpidl

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

  • C++ header files (.h) which include a commented out template for a full C++ implementation of the interface
  • XPConnect typelib files (.xpt) which contain runtime type information to call XPCOM objects dynamically 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 so that we can use it to generate the headers used by XPCOM components. Please check the Build Documentation for 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 also be used 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)

Document Tags and Contributors

Last updated by: fscholz,