idn-free.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* idn-free.h --- Invoke the `free' function releasing memory
  2. * allocated by libidn functions.
  3. * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Simon
  4. * Josefsson
  5. *
  6. * This file is part of GNU Libidn.
  7. *
  8. * GNU Libidn is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * GNU Libidn is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with GNU Libidn; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  21. *
  22. */
  23. #ifndef IDN_FREE_H
  24. # define IDN_FREE_H
  25. # ifndef IDNAPI
  26. # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
  27. # define IDNAPI __attribute__((__visibility__("default")))
  28. # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC
  29. # define IDNAPI __declspec(dllexport)
  30. # elif defined _MSC_VER && ! defined LIBIDN_STATIC
  31. # define IDNAPI __declspec(dllimport)
  32. # else
  33. # define IDNAPI
  34. # endif
  35. # endif
  36. /* I don't recommend using this interface in general. Use `free'.
  37. *
  38. * I'm told Microsoft Windows may use one set of `malloc' and `free'
  39. * in a library, and another incompatible set in a statically compiled
  40. * application that link to the library, thus creating problems if the
  41. * application would invoke `free' on a pointer pointing to memory
  42. * allocated by the library. This motivated adding this function.
  43. *
  44. * The theory of isolating all memory allocations and de-allocations
  45. * within a code package (library) sounds good, to simplify hunting
  46. * down memory allocation related problems, but I'm not sure if it is
  47. * worth enough to motivate recommending this interface over calling
  48. * `free' directly, though.
  49. *
  50. * See the manual section 'Memory handling under Windows' for more
  51. * information.
  52. */
  53. extern void IDNAPI idn_free (void *ptr);
  54. #endif /* IDN_FREE_H */