ImfExport.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. // Copyright (c) Contributors to the OpenEXR Project.
  4. //
  5. #ifndef INCLUDED_IMFEXPORT_H
  6. #define INCLUDED_IMFEXPORT_H
  7. #include "OpenEXRConfig.h"
  8. /// \addtogroup ExportMacros
  9. /// @{
  10. // are we making a DLL under windows (might be msvc or mingw or others)
  11. #if defined(OPENEXR_DLL)
  12. // when building as a DLL for windows, typical dllexport / import case
  13. // where we need to switch depending on whether we are compiling
  14. // internally or not
  15. # if defined(OPENEXR_EXPORTS)
  16. # define IMF_EXPORT __declspec(dllexport)
  17. // mingw needs the export when the extern is defined
  18. # if defined(__MINGW32__)
  19. # define IMF_EXPORT_EXTERN_TEMPLATE IMF_EXPORT
  20. # define IMF_EXPORT_TEMPLATE_INSTANCE
  21. // for mingw windows, we need to cause this to export the
  22. // typeinfo tables (but you don't need to have the
  23. // complementary import, because might be a local template too!)
  24. # define IMF_EXPORT_TEMPLATE_TYPE IMF_EXPORT
  25. # else
  26. // for normal msvc, need to export the actual instantiation in
  27. // the cpp code, and none of the others
  28. # define IMF_EXPORT_EXTERN_TEMPLATE
  29. # define IMF_EXPORT_TEMPLATE_INSTANCE IMF_EXPORT
  30. # define IMF_EXPORT_TEMPLATE_TYPE
  31. # endif
  32. # else // OPENEXR_EXPORTS
  33. # define IMF_EXPORT __declspec(dllimport)
  34. # define IMF_EXPORT_EXTERN_TEMPLATE IMF_EXPORT
  35. # define IMF_EXPORT_TEMPLATE_INSTANCE
  36. # define IMF_EXPORT_TEMPLATE_TYPE
  37. # endif
  38. // DLLs don't support these types of visibility controls, just leave them as empty
  39. # define IMF_EXPORT_TYPE
  40. # define IMF_EXPORT_ENUM
  41. # define IMF_HIDDEN
  42. #else // not an OPENEXR_DLL
  43. // just pass these through from the top level config
  44. # define IMF_EXPORT OPENEXR_EXPORT
  45. # define IMF_HIDDEN OPENEXR_HIDDEN
  46. # define IMF_EXPORT_ENUM OPENEXR_EXPORT_ENUM
  47. # define IMF_EXPORT_TYPE OPENEXR_EXPORT_TYPE
  48. # define IMF_EXPORT_TEMPLATE_TYPE OPENEXR_EXPORT_TEMPLATE_TYPE
  49. # define IMF_EXPORT_EXTERN_TEMPLATE OPENEXR_EXPORT_EXTERN_TEMPLATE
  50. # define IMF_EXPORT_TEMPLATE_INSTANCE OPENEXR_EXPORT_TEMPLATE_INSTANCE
  51. #endif // OPENEXR_DLL
  52. /// @}
  53. #endif // INCLUDED_IMFEXPORT_H