This page was created to give developers a first hand assistance in starting development of Mozilla Firefox plugins on Windows. After the generic development environment setup we present the setup of OggPlay Firefox plugin for Vorbis/Theora OggPlay player plugin. If you have an experience in plugin development and want to test or contribute to the OggPlay plugin development you might want to skip to the next section and go directly to OggPlay player plugin setup. If you do not have your development plugin environment set up you should start with basic plugin environment configuration.
Setup of basic Mozilla plugin development environment
The documentation on set up of development environment for Mozilla plugins development of Linux/UNIX, Win32 and MacOS is inconsistent and partially incomplete at least. In an attempt to fill in the blanks this section presents basic development environment setup for Win200x/XP/Vista.
Basic Mozilla plugin setup for MS Windows Win200x/XP
Although we tested those steps on Windows 2003 Server and Windows XP the configuration should work on the other Window platforms (such as Windows Vista). We also assume that you are using MS Visual Studio 2003 or 2005 altough you should be able to setup the environment using VS6 in a similar way. If you are using other environment/compiler you are on your own.
Before starting setting up your plugin development environment you will need following tools and SDKs:
- Mozilla Firefox (at least in version 1.7 provided you use appropriate Gecko SDK)
- Mozilla Gecko SDK - there are two recent releases of Gecko SDK (1.7 for Firefox 1.0 and 1.8 for Firefox 1.5. and 2.0) available for download on Mozilla Developer Center. Here are direct links to both versions of the SDK:
- Mozilla WinTools - to use xpidl compiler you need also Mozilla WinTools: Direct download
- Microsoft Platform SDK - to compile the plugins you will need to get also Platform SDK from Microsoft Download Center
Once you unzipped Gecko SDK and installed MS Platform SDK you need to make sure your xpidl compiler is working properly. Unfortunately, the official release of Gecko SDK assumes you have following .dll on your system and in your PATH (provided you are using the newest version of WinTools):
They are included in WinTools package under windows\bin\x86. In order for xpidl to run properly you need to have those .dll files in the same directory as xpidl.exe. Alternatively, if for some reason you do not want to copy those files across you can add the directory where those .dll are located to your system PATH variable. You can do that by navigating to Control Panel->System and then choosing Environment Variables in Advanced tab. There are also other options such as modifing Visual Studio environment by changing vcvarsall.bat script but it is outside of scope of this document.
Once your xpidl you can try your environment and compile the official Mozilla samples. More details presented in the next section.
Testing development environment with sample Mozilla plugin
This is an optional step and unless you failed setting up environment for the OggPlay plugin or you want to build your own plugin you can probably skip this step. But if you want to understand the Mozilla plugin structure it is probably recommended to start with something simple.
Once your xpidl you can try to compile the official Mozilla samples. You can download them here. The important thing about this archive is that we are interested only the Win32SDK\sdk\samples directory. In particular, attached gecko-sdk is not the most recent one. If you navigate to one of the samples and their windows directory you can open projects' .dsp file. If you are using newer version of Visual Studio than 6.0 it will be converted to the new format. Once you opened sample project you need probably update some of the configuration settings. In Project->Properties menu select C\C++->General and change Additional Include Directories to your Gecko SDK include directory (Note: this is preferably the new Gecko SDK in the archive gecko-sdk-i586-pc-msvc-1.7.zip or gecko-sdk-win32-msvc-220.127.116.11.zip and not the one attached to the samples archive). If you are using Gecko SDK 1.7 or Gecko SDK 1.8 you need to include samples include directory (i.e. ..\..\include) and only main Gecko SDK include (e.g. ..\..\..\gecko-sdk\include).
You also need to point Visual Studio to the xpidl compiler. This is required to compile .idl file in the project. To change the default setting go to Visual Studio Solution Explorer and open Properties setting for the .idl file. Inspect file's Custom Build Step and adjust the directories in relation to the project file (.vcproj for VS200x or .dsp for VS6.0). In particular, you might need to change not only the path to the xpidl compiler but also to the idl directory of your Gecko SDK (e.g. ..\..\..\..\gecko-sdk\xpcom\bin\xpidl -m header -I..\..\..\..\gecko-sdk\xpcom\idl $(InputPath) to ..\..\..\gecko-sdk\bin\xpidl -m header -I..\..\..\gecko-sdk\idl $(InputPath))
Now you should be able to compile the project. Resulting .dll and .xpt files should be copied to the Mozilla Firefox plugins directory (e.g. C:\Program Files\Mozilla Firefox\plugins). Once you've done that you can restart Mozilla. In general it is a good idea to use following options to during the startup: -P development -console so you can see the plugin output/debug information.
For help with setup of the environment and Visual Studio refere to a guide from Mozilla Developer Center.
Developing OggPlay plugin
Once you have a working Mozilla plugin development environment you can start configuring the environment for OggPlay plugin.