00001 /* idn-free.h --- Invoke the `free' function releasing memory 00002 * allocated by libidn functions. 00003 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Simon 00004 * Josefsson 00005 * 00006 * This file is part of GNU Libidn. 00007 * 00008 * GNU Libidn is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * GNU Libidn is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with GNU Libidn; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00021 * 00022 */ 00023 00024 #ifndef IDN_FREE_H 00025 # define IDN_FREE_H 00026 00027 # ifndef IDNAPI 00028 # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY 00029 # define IDNAPI __attribute__((__visibility__("default"))) 00030 # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC 00031 # define IDNAPI __declspec(dllexport) 00032 # elif defined _MSC_VER && ! defined LIBIDN_STATIC 00033 # define IDNAPI __declspec(dllimport) 00034 # else 00035 # define IDNAPI 00036 # endif 00037 # endif 00038 00039 /* I don't recommend using this interface in general. Use `free'. 00040 * 00041 * I'm told Microsoft Windows may use one set of `malloc' and `free' 00042 * in a library, and another incompatible set in a statically compiled 00043 * application that link to the library, thus creating problems if the 00044 * application would invoke `free' on a pointer pointing to memory 00045 * allocated by the library. This motivated adding this function. 00046 * 00047 * The theory of isolating all memory allocations and de-allocations 00048 * within a code package (library) sounds good, to simplify hunting 00049 * down memory allocation related problems, but I'm not sure if it is 00050 * worth enough to motivate recommending this interface over calling 00051 * `free' directly, though. 00052 * 00053 * See the manual section 'Memory handling under Windows' for more 00054 * information. 00055 */ 00056 00057 extern void IDNAPI idn_free (void *ptr); 00058 00059 #endif /* IDN_FREE_H */