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