libidn  1.25
idn-free.h
Go to the documentation of this file.
00001 /* idn-free.h --- Invoke the free function to release memory
00002    Copyright (C) 2004-2012 Simon Josefsson
00003 
00004    This file is part of GNU Libidn.
00005 
00006    GNU Libidn is free software: you can redistribute it and/or
00007    modify it under the terms of either:
00008 
00009      * the GNU Lesser General Public License as published by the Free
00010        Software Foundation; either version 3 of the License, or (at
00011        your option) any later version.
00012 
00013    or
00014 
00015      * the GNU General Public License as published by the Free
00016        Software Foundation; either version 2 of the License, or (at
00017        your option) any later version.
00018 
00019    or both in parallel, as here.
00020 
00021    GNU Libidn is distributed in the hope that it will be useful,
00022    but WITHOUT ANY WARRANTY; without even the implied warranty of
00023    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00024    General Public License for more details.
00025 
00026    You should have received copies of the GNU General Public License and
00027    the GNU Lesser General Public License along with this program.  If
00028    not, see <http://www.gnu.org/licenses/>. */
00029 
00030 #ifndef IDN_FREE_H
00031 # define IDN_FREE_H
00032 
00033 # ifndef IDNAPI
00034 #  if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
00035 #   define IDNAPI __attribute__((__visibility__("default")))
00036 #  elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC
00037 #   define IDNAPI __declspec(dllexport)
00038 #  elif defined _MSC_VER && ! defined LIBIDN_STATIC
00039 #   define IDNAPI __declspec(dllimport)
00040 #  else
00041 #   define IDNAPI
00042 #  endif
00043 # endif
00044 
00045 # ifdef __cplusplus
00046 extern "C"
00047 {
00048 # endif
00049 
00050 /* I don't recommend using this interface in general.  Use `free'.
00051  *
00052  * I'm told Microsoft Windows may use one set of `malloc' and `free'
00053  * in a library, and another incompatible set in a statically compiled
00054  * application that link to the library, thus creating problems if the
00055  * application would invoke `free' on a pointer pointing to memory
00056  * allocated by the library.  This motivated adding this function.
00057  *
00058  * The theory of isolating all memory allocations and de-allocations
00059  * within a code package (library) sounds good, to simplify hunting
00060  * down memory allocation related problems, but I'm not sure if it is
00061  * worth enough to motivate recommending this interface over calling
00062  * `free' directly, though.
00063  *
00064  * See the manual section 'Memory handling under Windows' for more
00065  * information.
00066  */
00067 
00068 extern void IDNAPI idn_free (void *ptr);
00069 
00070 # ifdef __cplusplus
00071 }
00072 # endif
00073 
00074 #endif /* IDN_FREE_H */