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 KcsProfile class and create a KcsProfile instance you must provide these mandatory external entry points:

extern long KcsDLOpen ProfCount; 
KcsProfile * KcsCreateProf(KcsStatus *sStat, KcsIO *aIO); 
KcsProfile * KcsCreateProBlnk(KcsStatus *aStat, KcsId aCmmID, 
    KcsVersion aCmmVersion, KcsId aProfId,
    KcsVersion aProfVersion);

The KcsCreateProf() entry point creates an instance of a KcsProfile derivative that is determined by the profile's CMM Id within aIO.

The KcsCreateProfBlnk() entry point creates an instance of a KcsProfile derivative that is determined by aCmmID and aCmmVersion. This is how an empty profile is created from scratch. The aProfId argument specifies which KcsProfileFormat derivative to use.

Optional

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

KcsStatusId KcsInitProf(); 
KcsStatusId KcsCleanupProf();

Example

Example 5-1 shows you how to use the entry points when creating a KcsProfile instance.


Example 5-1 KcsProfile Class Entry Points Example

/* Required entry points */ 
extern long KcsDLOpenProfCount = 0;  

/* Construct a profile object using KcsIO */ 
KcsProfile * KcsCreateProf(KcsStatus *aStat, KcsIO *aIO) 
{
     //Create the new derivative
     return (new KcsProfileKCMS(aStat, aIO)); 
} 
/* Construct an in-memory profile object using the ids */ 
KcsProfile * KcsCreateProfBlnk(KcsStatus *aStat, KcsId aCmmId,
      KcsVersion aCmmVersion, KcsId aProfId,
      KcsVersion aProfVersion) 
{
     //Create the new derivative
     return(new KcsProfileKCMS (aStat, aCmmId, aCmmVersion,
          aProfId, aProfVersion)); 
} 
/* Optional entry points */ 
KcsStatus KcsInitProf(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); 
}  

KcsStatus KcsCleanupProf() 
{
     /* Clean up is performed in the destructor */
     return; 
}