r6.0.0:lfds600_abstraction_aligned_free

From liblfds.org
Revision as of 14:07, 4 January 2015 by Admin (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source Files

/liblfds600/src/lfds600_abstraction/lfds600_abstraction_aligned_free.c
/liblfds600/inc/liblfds600.h

Prototype

void lfds600_abstraction_aligned_free( void *memory );

Parameters

void *memory

Pointer to memory previously allocated by lfds600_abstraction_aligned_malloc.

Return Value

No return value.

Notes

Some platforms (such as Windows) have a particular free function (as opposed to the normal free function) which must be used in conjunction with the aligned malloc function. Others (such as Linux) do not and the normal free function can be used.

Examples

Under Windows (32-bit and 64-bit), using the Microsoft C compiler, there is a particular function _aligned_free which must be used with memory allocated by the aligned memory allocator and this free function has the following prototype;

void _aligned_free( void *memblock );

As such, the implementation of lfds600_abstraction_aligned_free() on all Windows (user-mode), for all CPUs, using the Microsoft C compiler, looks like this;

#if (defined _WIN32 && defined _MSC_VER && !defined WIN_KERNEL_BUILD)

  /* TRD : any Windows on any CPU with the Microsoft C compiler

           _WIN32             indicates 64-bit or 32-bit Windows
           _MSC_VER           indicates Microsoft C compiler
           !WIN_KERNEL_BUILD  indicates Windows user-mode
  */

  void lfds600_abstraction_aligned_free( void *memory )
  {
    _aligned_free( memory );

    return;
  }

#endif

See Also