# CmtGetThreadLocalVar

int CmtGetThreadLocalVar (int variableHandle, void *variablePointer);

## Purpose

Gets a pointer to the thread local variable instance for the current thread.

The first time you call this function from a thread, the variable is initialized to the value pointed to by the variableInitialValue parameter that you passed to CmtNewThreadLocalVar.

## Parameters

Input
Name | Type | Description
variableHandle | integer | The handle you obtained from CmtNewThreadLocalVar to identify the thread local variable.
Output
Name | Type | Description
variablePointer | Any pointer (passed by reference) | Returns a pointer to the thread local variable instance for the current thread. Pass the address of a pointer to the type of the thread local variable.

## Return Value

Name | Type | Description
CmtStatus | integer | The CmtStatus code that the function call returns. This function returns 0 to indicate success and negative values to indicate failure. Pass the CmtStatus code to CmtGetErrorMessage to get a description of the error code.