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 KcsProfileFormat class, the mandatory external entry points are:

extern long KcsDLOpenPfmtCount; 
KcsProfileFormat *KcsCreatePfmt(KcsStatus *sStat, KcsIO *aIO); 
KcsProfileFormat *KcsCreatePfmtBlnk(KcsStatus *aStat,
      KcsId aCmmId, KcsVersion aCmmVersion, KcsId aProfId,
      KcsVersion aProfVersion);

KcsCreatePfmt() creates an instance of a KcsProfileFormat derivative. The derivative is determined by the version information contained within the data represented by aIO. This corresponds to the KcsLoadProfile() call.

KcsCreatePfmtBlnk() creates an instance of a KcsProfileFormat derivative that is determined by aProfId. This creates a blank profile version instance with no objects associated with the returned instance. It initializes the CMM type identifier, the CMM version, and the profile version from aCmmId, aCmmVersion, and aProfVersion, respectively.

Optional

When you derive from a KcsProfileFormat class, the optional "C" based entry points are:

KcsStatus KcsInitPfmt(); 
KcsStatus KcsCleanupPfmt();

Examples

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


Example 6-1 KcsProfileFormat Class Entry Points Example

extern long KcsDLOpenPfmtCount = 0;  

/* Global initialization - constructor can be used */ 
KcsStatus 
KcsInitPfmt(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); 
}  

/* Clean up global initialization */ 
KcsStatus 
KcsCleanupPfmt() 
{
     KcsStatus sStat;
     return(KCS_SUCCESS); 
}  

/* Create a profile format derivative based on information passed in,  
* there is profile data associated with it. Corresponds to the  
* KcsCreateProfile() API call. */ 
KcsProfileFormat * 
KcsCreatePfmtBlnk(KcsStatus *aStat, KcsId aCmmId,
      KcsVersion aCmmVersion, KcsId aProfId, KcsVersion aProfileVersion) 
{
     //Create the new derivative
     return(new KcsProfileFormatInterColor3_0(aStat, aCmmId,
          aCmmVersion, aProfId, aProfileVersion)); 
}  

/* Create a profile format derivative using the supplied IO.  
* Corresponds to the KcsLoadProfile() API call. */ 
KcsProfileFormat * KcsCreatePfmt(KcsStatus *aStat, KcsIO *aIO) 
{
     //Create the new derivative
     return(new KcsProfileFormatInterColor3_0(aStat, aIO));
}