As described in Adding System Routines, you must register your system routine before IDL will recognize it. When registering the routine, you indicate that it accepts keyword arguments in one of the following ways:

  • Specifying the KEYWORDS option for the routine in the module definition file of a Dynamically Loadable Module (DLM).
  • Setting the KEYWORDS keyword in a call to LINKIMAGE.
  • OR-ing the constant IDL_SYSFUN_DEF_F_KEYWORDS into the flags field of the IDL_SYSFUN_DEF2 struct passed to IDL_SysRtnAdd()

Routines that accept keywords must perform keyword processing. A routine that does not allow keyword processing knows that its argc argument gives the number of positional arguments, and argv contains only those positional arguments. In contrast, a routine that accepts keywords receives an argc that gives the total number of positional and keyword arguments, and these arguments are delivered in argv mixed together in an undefined order.

The function IDL_KWProcessByOffset() is used to process keywords and separate the positional and keyword arguments. It is passed an array of IDL_KW_PAR structures that give information about the allowed keywords and their attributes. The keyword data resulting from this process is stored in a user defined KW_RESULT structure. Finally, the IDL_KW_FREE macro is used to clean up.

More information about these routines and structures can be found in the following sections.