Defining Third-Party CM Tool Interfaces : User Function Interface to CM Tool

User Function Interface to CM Tool

There is an API in the Rational Statemate CM DLL called STM_CM_init_item. This API is called by the tool on any CM item, before any other call is done on this item, and only once per configuration item per session.

This API is optional. The tool calls it only if it is implemented in the specific DLL used.

Define the Dynamic-Library path name in the cm_tool_name.cmt file located in the directory $$STM-ROOT/etc/cmt/. For example:

DLL-NAME /root31/bin/stm_cm_user.dll

 

Note: The DLL path name should be all lowercase.

API functions (see stm_cn_user,h)

#define STM_CM_success 0

#define STM_CM_message_length 1024

#define STM_CM_archive_name_length 2048

#define STM_CM_version_length 80

#define STM_CM_user_name_length 512

When the return value of a certain API is of type “int”, the following convention holds:

Memory management is done independently between STMM and the dynamic-library:

When STMM calls a certain API with parameters defined as “const char *”, the intention is that those are managed by STMM and should be regarded as read-only variables.
When STMM calls a certain API with parameters defined as “char [length]” (with length being either 512 or 1024), the intention is for the API to use the parameters as error messages and returned information.
When STMM calls a certain API with parameters defined as “char * []” (as in 2.n, 2.p), the intention is that those are managed by the dynamic-library. STMM copies the content as soon as the API returns. It is recommended to use static buffers in the dynamic-library implementation for those parameters.

For building the DLL, you can use stm_cm_user.def file:

LIBRARY
stm_cm_user
EXPORTS

The following sections describe the user functions: