General guideline for plug-in coding.

1  Reference document and open source license(NPL/MPL).

Here are some links that may be useful for plugin development in general.

Note: those code samples are subject to the Netscape Public License(NPL) Version 1.1 or the Mozilla Public License(MPL) Version 1.1 ---- (the "License"). You may not use these files except in compliance with the License.

You may obtain a copy of the License at http://www.mozilla.org/NPL/ or http://www.mozilla.org/MPL/

2  Include necessary header files.

You will need to include the following files in your source or header files:

Those header files is already placed in SDK folder $(DK_DIR)/include. Their pathes should also be specified exactly in Makefile, you can refer to Step 1: Building and using the plug-in and Makefile for more information.


# Include files and libraries
CPPFLAGS += -I$(DK_DIR)/include/npapi
CPPFLAGS += -I$(DK_DIR)/include/eklibrary_webkit/EKLibrary/PublicHeaders
CPPFLAGS += -I$(DK_DIR)/include/eklibrary_webkit/EKLibrary/PublicHeaders/Plugins

Note: in order to use those header files properly in KreaTV's plug-in development, the define "XP_UNIX" is a must-have macro in your Makefile.


EXTRA_FLAGS = -DXP_UNIX ##XP_UNIX is a must-have macro. You may need add your own defines here.

3  Must-implemented API.

All the Plug-in Side APIs and Browser Side APIs must be implemented but you can leave part of them as an empty function according to your plug-in function requirement. Please check The Plug-in APIs Introduction from Step 3: Scripting plug-in. You can also find full list of those APIs from "npapi.h" and "npfunctions.h" mentioned previously.



Detail about writing the plug-in will be described in separate steps, please refer to Step 2: Initializing/destroying plug-in, and creating plug-in instance, Step 3: Scripting plug-in and Step 4: Drawing and handling event for more information.