# ctaGetVersionEx

Returns the Natural Access Server version, build date, and compatibility level.

#### Prototype

DWORD ctaGetVersionEx ( CTAHD ctahd, CTA_REV_INFO *pinfo, DWORD size)

Argument | Description
ctahd | Context handle that specifies the server on which commands are executed. ctahd can be a void context handle.
pinfo | Pointer to the memory area. The CTA_REV_INFO structure is: typedef struct { DWORD size; DWORD majorrev; DWORD minorrev; char builddate [12]; DWORD compatlevel; } CTA_REV_INFO; See the Details section for a description of these fields.
size | Size of the data structure.

#### Return values

Return value | Description
CTAERR_BAD_SIZE | size is not valid.
CTAERR_BAD_ARGUMENT | pinfo is NULL.
CTAERR_INVALID_CTAHD | Context handle is invalid.
CTAERR_NOT_INITIALIZED | Natural Access is not initialized. Call ctaInitialize first.
CTAERR_SVR_COMM | Server communication error.

#### Details

ctaGetVersionEx returns the Natural Access Server version, build date, and compatibility level.

ctahd can be a void context handle. A void context handle refers only to the server on which the commands are executed and not to any real context object. Each server has a unique void context handle. If the void context handle is equal to NULL_CTAHD, it refers to the default server.

The CTA_REV_INFO structure contains the following fields:

Field | Description
--- | ---
size | Number of bytes written at the address pointed to by pinfo.
majorrev | Major revision number of Natural Access. This value changes when a Natural Access release contains major enhancements such as new APIs or new services.
minorrev | Minor revision of Natural Access. This value changes when a Natural Access release contains minor enhancements, bug fixes, or both.
builddate | A NULL-terminated string indicating the build date of the revision, in mm dd yyyy format.
compatlevel | Compatibility level of the specified server. The compatibility level changes when the release includes enhancements that require applications to be recompiled because the changes are not backward compatible.

Refer to Verifying compatibility for more information.

#### Example

/* Abort execution if NMS delivers version with compatibility level changed: */
void DemoCheckVersion( void )
{
CTA_REV_INFO info;
CTAHD void_ctahd;
/* Server name descriptor */
char server_desc[] = "host.nmss.com:2244";
/* Create a void context handle */
ctaCreateContext(NULL_CTAQUEUEHD, 0, server_desc, &void_ctahd);
ctaGetVersionEx( void_ctahd, &info, sizeof(info) );
if ( info.compatlevel != CTA_COMPATLEVEL )
{
printf("Natural Access compatibility level does not match.
Re-compile.\n");
exit(-1);
}
}