Previous: Autoconf tests, Up: Preparation [Contents][Index]
Several functions in the library allocates memory. The memory is
expected to be de-allocated using the free
function. Under
Windows, it is sometimes necessary to de-allocate memory in the same
module that allocated a memory region. The reason is that different
modules use separate heap memory regions. To solve this problem we
provide a function to de-allocate memory inside the library.
Note that we do not recommend using this interface generally if you do not care about Windows portability.
idn-free.h
To use the function explained in this chapter, you need to include the file idn-free.h using:
#include <idn-free.h>
ptr: memory region to deallocate, or NULL
.
Deallocates memory region by calling free()
. If ptr
is NULL
no
operation is performed.
Normally applications de-allocate strings allocated by libidn by
calling free()
directly. Under Windows, different parts of the
same application may use different heap memory, and then it is
important to deallocate memory allocated within the same module
that allocated it. This function makes that possible.