Skip to main content
Skip table of contents

(v13) Implementing selector operations

This page applies to Harlequin v13.1r0 and later; and to Harlequin MultiRIP but not Harlequin Core

A switch statement is typically used to map the selector to code that implements the plugin operation it calls for. Each case casts the selector‐specific third argument to the required type, and either carries out the operation or calls another function to do so. Results are usually returned via a status field in one of the parameters passed with the selector; the return value of the PLUGIN function should still follow the rules stated in (v13) Plugin call return values . For example:

TEXT
  OSErr OPInitialise(deviceDefinition *pdevdef, int32 *pvParam); OSErr OPShutdown(deviceDefinition *pdevdef);
  OSErr PLUGIN ( short selector, deviceDefinition *dev, void *param ) [...]
  switch(nSelector) {
    case D_INITIALISE:
      nRetVal = OPInitialise(pdevdef, (int32 *)pvParam); break;
    case D_SHUTDOWN:
      nRetVal = OPShutdown(pdevdef); break;
    [ ... ]
    default:
      nRetVal = -1; break;
  }
  return nRetVal;

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.