Writing Plug-ins

A plug-in host calls a plug-in module in response to a user action.

Generally, executing a user command results in a series of calls from the plug-in host to the plug-in module. All calls from the host to the module are done through a single entry point, the main() routine of the plug-in module. The prototype for the main entry point is:

#if MSWindows
void ENTRYPOINT (
    short   selector,
    void*   pluginParamBlock,
    long*   pluginData,
    short*  result);
#else
pascal void main (
    short   selector,
    Ptr     pluginParamBlock,
    long*   pluginData,
    short*  result);
#endif

For further details about the arguments to the plug-in entry point, see Plug-in Entry Point.

The sequence of calls from the host to the plug-in represent a series of actions requested by the host. Each of these actions is represented by a different selector. Each plug-in type has its own selectors and expected sequence of selectors, which are detailed in the following pages: