OpenClovis Logo

API Usage Examples

Code Examples.

Code Examples.

Here the allocation and deallocation of the memory is shown. These are very simple operations and very similar to malloc() and free() system calls.

ClRcT retCode = CL_OK;
ClCharT *pStr = NULL;
pStr = (ClCharT*) clHeapAllocate(1024);
if(pStr == NULL)
{
// There is insufficient memory and because of it the memory
// allocation failed.
}
// Now the memory allocate in pStr can be used like a character array.
retCode = clHeapFree(pStr);
if(CL_OK != retCode)
{
// Freeing of the allocated memory failed.
}
// allocated memory is freed successfully.
ClUint32T ClRcT
Clovis return code type.
Definition: clCommon.h:168
#define CL_OK
Every thing is OK.
Definition: clCommonErrors.h:68
void clHeapFree(CL_IN ClPtrT pAddress)
Frees a pre-allocated memory.
ClPtrT clHeapAllocate(CL_IN ClUint32T size)
Allocates memory of the requested size.

Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen