KCMS CMM Developer's Guide

External Entry Points

The KCMS framework uses external entry points to load your derivative as an executable. The mandatory and optional entry points are described.

Mandatory

When you derive from a KcsXform class, the mandatory external entry points are:

extern long KcsDLOpenXfrmCount; 
KcsXform * KcsCreateXfrm(KcsStatus *aStat, 
    KcsChunkSet *aChunkSet, KcsChunkId aChunkId,
    KcsAttributeSet *aAttrSet);

KcsCreateXfrm() creates an instance of a KcsXform derivative.

Optional

When you derive from a KcsXform class, the optional entry points are:

KcsStatus KcsInitXfrm(); 
KcsStatus KcsCleanupXfrm();

Example

The following example shows you how to use the entry points when creating a KcsXform derivative.


Example 7-1 KcsXform Class Entry Points Example

extern long KcsDLOpenXfrmCount = 0;  

/* Global initialization */ 
KcsStatus 
KcsInitXfrm(long libMajor, long libMinor, long *myMajor, long *myMinor) 
{
     // Set up the return values
     *myMajor = KCS_MAJOR_VERSION;
     *myMinor = KCS_MINOR_VERSION;

      //Check the major version
      if (libMajor != KCS_MAJOR_VERSION)
         return (KCS_CMM_MAJOR_VERSION_MISMATCH);

      //Currently, if minor version of library is less than the KCMS
      // minor version, return < an error.
      if (libMinor  KCS_MINOR_VERSION)
         return (KCS_CMM_MINOR_VERSION_MISMATCH);

      //Library guarantees if your minor version number is greater than
      //KCMS minor version number, it will handle it. No more init.
      return(KCS_SUCCESS); 
}  

KcsXform * KcsCreateXfrm(KcsStatus *aStat, KcsChunkSet *aCS,
      KcsChunkId aChunkId, KcsAttributeSet *aAttrSet) 
{
     //Create the new derivative
     return(new KcsTechUCP(aStat, KcsLoadAllow, aCS, aChunkId,
          aAttrSet)); 
}

/* Global clean up */ 
KcsStatus 
KcsCleanupXfrm() 
{
     KcsStatus sStat;
     return(KCS_SUCCESS);
}