Trading API for C  7.0.0.309536
Utility functions.

Functions

void * ctl_calloc (size_t nmemb, size_t size)
 Allocate and zero an array of elements. More...
 
void ctl_free (void *block)
 Free the supplied memory block. More...
 
void * ctl_malloc (size_t size)
 Allocate a chunk of memory. More...
 
void * ctl_realloc (void *orig, size_t size)
 Reallocate the supplied memory. More...
 
void ctl_set_allocator (void *(*realloc_func)(void *ctx, void *orig, size_t size), void(*free_func)(void *ctx, void *), void *ctx)
 Set the allocator that will be used by the library. More...
 
char * ctl_strdup (const char *orig)
 Duplicate the supplied string. More...
 

Detailed Description

Function Documentation

void* ctl_calloc ( size_t  nmemb,
size_t  size 
)

Allocate and zero an array of elements.

Parameters
nmemb- Number of elements
size- Size of each element
Returns
The zeroed array
void ctl_free ( void *  block)

Free the supplied memory block.

Parameters
block- Memory block to release
void* ctl_malloc ( size_t  size)

Allocate a chunk of memory.

Parameters
size- Amount of memory to allocate
Returns
The allocated memory
void* ctl_realloc ( void *  orig,
size_t  size 
)

Reallocate the supplied memory.

Parameters
orig- The original memory block (may be NULL)
size- New size of the memory block
Returns
The allocated memory
void ctl_set_allocator ( void *(*)(void *ctx, void *orig, size_t size)  realloc_func,
void(*)(void *ctx, void *)  free_func,
void *  ctx 
)

Set the allocator that will be used by the library.

Parameters
realloc_func- Function for realloc() - this function MUST accept NULL as the original block parameter
free_func- Function for free()
ctx- User specified context that will be supplied to the allocator calls

By default the library will use the standard library allocation functions, you can use this function to redirect all memory usage by the library to a custom implementation. If you wish to use this functionality then you MUST call this function prior to any other calls into the Trading API.

The ctx parameter can be used to hold a reference to your memory pool/arena.

char* ctl_strdup ( const char *  orig)

Duplicate the supplied string.

Parameters
orig- The string to duplicate
Returns
A duplicate of orig

This function will use the allocation routines set using sl_set_allocator() to duplicate the supplied string


Generated on Thu Jun 15 2017 10:22:29 for Trading API for C