Community articleFCMRegisterFunctionCall
Added by IBM contributorIBM on May 2, 2012
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.


Registers your custom function with the Function Call Manager.


r_short FCMRegisterFunctionCall(
   FunctionCall *theFunctionCallObject, 
   r_charP thePackageName,
   r_charP theFunctionName,
   r_u_long theFunctionID,
   r_u_long theFlags,
   r_charP theCallingParams,
   r_u_long theVersion,
   r_charP theQuickDesc);


Table 1. register function call parameters
theFunctionCallObjectFunctionCall*The FunctionCall that will handle requests for the function. Setting: Name of the FunctionCall.
thePackageNamer_charPThe name of the package that will contain the function. Setting: Name of the package.
theFunctionNamer_charPThe name of the function. Setting: Name of the function.
theFunctionIDr_u_longA unique number that can be used to identify the function. Setting: The Function ID. See Notes for more information.
theFlagsr_u_longA set of flags which indicate how the custom function will be evaluated. Setting: Typically FCI_FOLLOWS_STRICT_CALLING_ PARAMETERS or 0. See Notes for more information.
theCallingParamsr_charPThe list of parameters that this function takes. Setting: S, O, or R. See Notes for more information.
theVersionr_u_longThe version number of the function. Setting: Function Version Number. See Defining a Version Number below for more information.
theQuickDesc r_charPA quick one-line description of what the function does.


OK on success or an error code on failure.


theFunctionID - Each function that you create as part of a particular package must have a unique identification number. Define each function's ID number as a constant at the beginning of the class. For example the multiply function has an ID number of 1:
#define MULTIPLY_ID 1;

theCallingParams - List the type of each parameter that the function will take and separate each value with a comma.
  • Use S to indicate a string parameter.
  • If the parameter is optional, then an O is added after the S.
  • If the parameter can repeat, then an R is added after the S.
  • For example, if you were to register a function that had to have one parameter and optionally a second parameter then the theCallingParams would look like the following:
  •          "S,SO"

  • If there are no parameters, use an empty string ("").
Defining a Version Number
  • If multiple FunctionCall objects register the same function for the same package, then the function with the highest version number is used.
  • Version numbers are defined in hexadecimal format as follows, where the 0300 is a constant and must be present :
  •       0x<major><minor><maintenance><0300>

  • For example, a function that is version 2.1 would be represented as
  •  0x02010300

  • Define a function's version number in the parameter theVersion.


In the following example, the multiply function is registered with the Function Call Manager as a part of a package called test_Package.
The multiply function takes two string parameters and has the version number: 1.0
PRE_FUNCTION_DECL r_short POST_FUNCTION_DECL C_ExtensionInit(Extension *theExtension, 
   IFX *theIFXManager)
FunctionCall *theFunctionCall;
r_short theError;
      if ((theFunctionCall = (FunctionCall*)IFSObject_AllocateObject(
         0)) == NULL)
         return NOTOK;
      if ((theError = FCMRegisterFunctionCall( theFunctionCall, PACKAGE_NAME,
         "multiply", FCI_MULTIPLY_ID,
      return OK;