Crypto++ 8.9
Free C++ class library of cryptographic schemes
config_dll.h
Go to the documentation of this file.
1// config_dll.h - written and placed in public domain by Jeffrey Walton
2// the bits that make up this source file are from the
3// library's monolithic config.h.
4
5/// \file config_dll.h
6/// \brief Library configuration file
7/// \details <tt>config_dll.h</tt> provides defines for shared objects and
8/// dynamic libraries. Generally speaking the macros are used to export
9/// classes and template classes from the Win32 dynamic link library.
10/// When not building the Win32 dynamic link library they are mostly an extern
11/// template declaration.
12/// \details In practice they are a furball coughed up by a cat and then peed
13/// on by a dog. They are awful to get just right because of inconsistent
14/// compiler support for extern templates, manual instantiation and the FIPS DLL.
15/// \details <tt>config.h</tt> was split into components in May 2019 to better
16/// integrate with Autoconf and its feature tests. The splitting occurred so
17/// users could continue to include <tt>config.h</tt> while allowing Autoconf
18/// to write new <tt>config_asm.h</tt> and new <tt>config_cxx.h</tt> using
19/// its feature tests.
20/// \note You should include <tt>config.h</tt> rather than <tt>config_dll.h</tt>
21/// directly.
22/// \sa <A HREF="https://github.com/weidai11/cryptopp/issues/835">Issue 835,
23/// Make config.h more autoconf friendly</A>,
24/// <A HREF="https://www.cryptopp.com/wiki/Configure.sh">Configure.sh script</A>,
25/// <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,
26/// and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>
27/// on the Crypto++ wiki
28/// \since Crypto++ 8.3
29
30#ifndef CRYPTOPP_CONFIG_DLL_H
31#define CRYPTOPP_CONFIG_DLL_H
32
33#include "config_os.h"
34
35#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
36
37 /// \brief Win32 define for dynamic link libraries
38 /// \details CRYPTOPP_IMPORTS is set in the Visual Studio project files.
39 /// When the macro is set, <tt>CRYPTOPP_DLL</tt> is defined to
40 /// <tt>__declspec(dllimport)</tt>.
41 /// \details This macro has no effect on Unix &amp; Linux.
42 /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,
43 /// and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>
44 /// on the Crypto++ wiki
45 #define CRYPTOPP_IMPORTS ...
46
47 /// \brief Win32 define for dynamic link libraries
48 /// \details CRYPTOPP_EXPORTS is set in the Visual Studio project files.
49 /// When the macro is set, <tt>CRYPTOPP_DLL</tt> is defined to
50 /// <tt>__declspec(dllexport)</tt>.
51 /// \details This macro has no effect on Unix &amp; Linux.
52 /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,
53 /// and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>
54 /// on the Crypto++ wiki
55 #define CRYPTOPP_EXPORTS ...
56
57 /// \brief Win32 define for dynamic link libraries
58 /// \details CRYPTOPP_IS_DLL is set in the Visual Studio project files.
59 /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,
60 /// and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>
61 /// on the Crypto++ wiki
62 #define CRYPTOPP_IS_DLL
63
64 /// \brief Instantiate templates in a dynamic library
65 /// \details CRYPTOPP_DLL_TEMPLATE_CLASS decoration should be used
66 /// for classes intended to be exported from dynamic link libraries.
67 /// \details This macro is primarily used on Win32, but sees some
68 /// action on Unix &amp; Linux due to the source file <tt>dll.cpp</tt>.
69 /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,
70 /// and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>
71 /// on the Crypto++ wiki
72 #define CRYPTOPP_DLL_TEMPLATE_CLASS ...
73
74 /// \brief Instantiate templates in a dynamic library
75 /// \details CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS decoration should be used
76 /// for template classes intended to be exported from dynamic link libraries.
77 /// \details This macro is primarily used on Win32, but sees some
78 /// action on Unix &amp; Linux due to the source file <tt>dll.cpp</tt>.
79 /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,
80 /// and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>
81 /// on the Crypto++ wiki
82 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS ...
83
84 /// \brief Instantiate templates in a dynamic library
85 /// \details CRYPTOPP_STATIC_TEMPLATE_CLASS decoration should be used
86 /// for template classes intended to be exported from dynamic link libraries.
87 /// \details This macro is primarily used on Win32, but sees some
88 /// action on Unix &amp; Linux due to the source file <tt>dll.cpp</tt>.
89 /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,
90 /// and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>
91 /// on the Crypto++ wiki
92 #define CRYPTOPP_STATIC_TEMPLATE_CLASS ...
93
94 /// \brief Instantiate templates in a dynamic library
95 /// \details CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS decoration should be used
96 /// for template classes intended to be exported from dynamic link libraries.
97 /// \details This macro is primarily used on Win32, but sees some
98 /// action on Unix &amp; Linux due to the source file <tt>dll.cpp</tt>.
99 /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,
100 /// and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>
101 /// on the Crypto++ wiki
102 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS ...
103
104 /// \brief Override for internal linkage
105 /// \details CRYPTOPP_TABLE can be used to override internal linkage
106 /// on tables with the <tt>const</tt> qualifier. According to C++ rules
107 /// a declaration with <tt>const</tt> qualifier is internal linkage.
108 /// \note The name CRYPTOPP_TABLE was chosen because it is often used to
109 /// export a table, like AES or SHA constants. The name avoids collisions
110 /// with the DLL gear macros, like CRYPTOPP_EXPORTS and CRYPTOPP_EXTERN.
111 #define CRYPTOPP_TABLE extern
112
113 /// \brief Win32 calling convention
114 /// \details CRYPTOPP_API sets the calling convention on Win32.
115 /// On Win32 CRYPTOPP_API is <tt>__cedcl</tt>. On Unix &amp; Linux
116 /// CRYPTOPP_API is defined to nothing.
117 /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>
118 /// on the Crypto++ wiki
119 #define CRYPTOPP_API ...
120
121#else // CRYPTOPP_DOXYGEN_PROCESSING
122
123#if defined(CRYPTOPP_WIN32_AVAILABLE)
124
125 #if defined(CRYPTOPP_EXPORTS)
126 # define CRYPTOPP_IS_DLL
127 # define CRYPTOPP_DLL __declspec(dllexport)
128 #elif defined(CRYPTOPP_IMPORTS)
129 # define CRYPTOPP_IS_DLL
130 # define CRYPTOPP_DLL __declspec(dllimport)
131 #else
132 # define CRYPTOPP_DLL
133 #endif
134
135 // C++ makes const internal linkage
136 #define CRYPTOPP_TABLE extern
137 #define CRYPTOPP_API __cdecl
138
139#else // not CRYPTOPP_WIN32_AVAILABLE
140
141 // C++ makes const internal linkage
142 #define CRYPTOPP_TABLE extern
143 #define CRYPTOPP_DLL
144 #define CRYPTOPP_API
145
146#endif // CRYPTOPP_WIN32_AVAILABLE
147
148#if defined(__MWERKS__)
149# define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
150#elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
151# define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
152#else
153# define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
154#endif
155
156#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
157# define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
158#else
159# define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
160#endif
161
162#if defined(__MWERKS__)
163# define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
164#elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
165# define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
166#else
167# define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
168#endif
169
170#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
171# define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
172#else
173# define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
174#endif
175
176#endif // CRYPTOPP_DOXYGEN_PROCESSING
177
178#endif // CRYPTOPP_CONFIG_DLL_H
Library configuration file.