Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:55

0001 // config_dll.h - written and placed in public domain by Jeffrey Walton

0002 //                the bits that make up this source file are from the

0003 //                library's monolithic config.h.

0004 
0005 /// \file config_dll.h

0006 /// \brief Library configuration file

0007 /// \details <tt>config_dll.h</tt> provides defines for shared objects and

0008 ///  dynamic libraries. Generally speaking the macros are used to export

0009 ///  classes and template classes from the Win32 dynamic link library.

0010 ///  When not building the Win32 dynamic link library they are mostly an extern

0011 ///  template declaration.

0012 /// \details In practice they are a furball coughed up by a cat and then peed

0013 ///  on by a dog. They are awful to get just right because of inconsistent

0014 ///  compiler support for extern templates, manual instantiation and the FIPS DLL.

0015 /// \details <tt>config.h</tt> was split into components in May 2019 to better

0016 ///  integrate with Autoconf and its feature tests. The splitting occurred so

0017 ///  users could continue to include <tt>config.h</tt> while allowing Autoconf

0018 ///  to write new <tt>config_asm.h</tt> and new <tt>config_cxx.h</tt> using

0019 ///  its feature tests.

0020 /// \note You should include <tt>config.h</tt> rather than <tt>config_dll.h</tt>

0021 ///  directly.

0022 /// \sa <A HREF="https://github.com/weidai11/cryptopp/issues/835">Issue 835,

0023 ///  Make config.h more autoconf friendly</A>,

0024 ///  <A HREF="https://www.cryptopp.com/wiki/Configure.sh">Configure.sh script</A>,

0025 ///  <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,

0026 ///  and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>

0027 ///  on the Crypto++ wiki

0028 /// \since Crypto++ 8.3

0029 
0030 #ifndef CRYPTOPP_CONFIG_DLL_H
0031 #define CRYPTOPP_CONFIG_DLL_H
0032 
0033 #include "config_os.h"
0034 
0035 #if defined(CRYPTOPP_DOXYGEN_PROCESSING)
0036 
0037     /// \brief Win32 define for dynamic link libraries

0038     /// \details CRYPTOPP_IMPORTS is set in the Visual Studio project files.

0039     ///  When the macro is set, <tt>CRYPTOPP_DLL</tt> is defined to

0040     ///  <tt>__declspec(dllimport)</tt>.

0041     /// \details This macro has no effect on Unix &amp; Linux.

0042     /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,

0043     ///  and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>

0044     ///  on the Crypto++ wiki

0045     #define CRYPTOPP_IMPORTS ...
0046 
0047     /// \brief Win32 define for dynamic link libraries

0048     /// \details CRYPTOPP_EXPORTS is set in the Visual Studio project files.

0049     ///  When the macro is set, <tt>CRYPTOPP_DLL</tt> is defined to

0050     ///  <tt>__declspec(dllexport)</tt>.

0051     /// \details This macro has no effect on Unix &amp; Linux.

0052     /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,

0053     ///  and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>

0054     ///  on the Crypto++ wiki

0055     #define CRYPTOPP_EXPORTS ...
0056 
0057     /// \brief Win32 define for dynamic link libraries

0058     /// \details CRYPTOPP_IS_DLL is set in the Visual Studio project files.

0059     /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,

0060     ///  and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>

0061     ///  on the Crypto++ wiki

0062     #define CRYPTOPP_IS_DLL
0063 
0064     /// \brief Instantiate templates in a dynamic library

0065     /// \details CRYPTOPP_DLL_TEMPLATE_CLASS decoration should be used

0066     ///  for classes intended to be exported from dynamic link libraries.

0067     /// \details This macro is primarily used on Win32, but sees some

0068     ///  action on Unix &amp; Linux due to the source file <tt>dll.cpp</tt>.

0069     /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,

0070     ///  and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>

0071     ///  on the Crypto++ wiki

0072     #define CRYPTOPP_DLL_TEMPLATE_CLASS ...
0073 
0074     /// \brief Instantiate templates in a dynamic library

0075     /// \details CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS decoration should be used

0076     ///  for template classes intended to be exported from dynamic link libraries.

0077     /// \details This macro is primarily used on Win32, but sees some

0078     ///  action on Unix &amp; Linux due to the source file <tt>dll.cpp</tt>.

0079     /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,

0080     ///  and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>

0081     ///  on the Crypto++ wiki

0082     #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS ...
0083 
0084     /// \brief Instantiate templates in a dynamic library

0085     /// \details CRYPTOPP_STATIC_TEMPLATE_CLASS decoration should be used

0086     ///  for template classes intended to be exported from dynamic link libraries.

0087     /// \details This macro is primarily used on Win32, but sees some

0088     ///  action on Unix &amp; Linux due to the source file <tt>dll.cpp</tt>.

0089     /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,

0090     ///  and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>

0091     ///  on the Crypto++ wiki

0092     #define CRYPTOPP_STATIC_TEMPLATE_CLASS ...
0093 
0094     /// \brief Instantiate templates in a dynamic library

0095     /// \details CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS decoration should be used

0096     ///  for template classes intended to be exported from dynamic link libraries.

0097     /// \details This macro is primarily used on Win32, but sees some

0098     ///  action on Unix &amp; Linux due to the source file <tt>dll.cpp</tt>.

0099     /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>,

0100     ///  and <A HREF="https://www.cryptopp.com/wiki/FIPS_DLL">FIPS DLL</A>

0101     ///  on the Crypto++ wiki

0102     #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS ...
0103 
0104     /// \brief Override for internal linkage

0105     /// \details CRYPTOPP_TABLE can be used to override internal linkage

0106     ///  on tables with the <tt>const</tt> qualifier. According to C++ rules

0107     ///  a declaration with <tt>const</tt> qualifier is internal linkage.

0108     /// \note The name CRYPTOPP_TABLE was chosen because it is often used to

0109     ///  export a table, like AES or SHA constants. The name avoids collisions

0110     ///  with the DLL gear macros, like CRYPTOPP_EXPORTS and CRYPTOPP_EXTERN.

0111     #define CRYPTOPP_TABLE extern
0112 
0113     /// \brief Win32 calling convention

0114     /// \details CRYPTOPP_API sets the calling convention on Win32.

0115     ///  On Win32 CRYPTOPP_API is <tt>__cedcl</tt>. On Unix &amp; Linux

0116     ///  CRYPTOPP_API is defined to nothing.

0117     /// \sa <A HREF="https://www.cryptopp.com/wiki/Visual_Studio">Visual Studio</A>

0118     ///  on the Crypto++ wiki

0119     #define CRYPTOPP_API ...
0120 
0121 #else  // CRYPTOPP_DOXYGEN_PROCESSING

0122 
0123 #if defined(CRYPTOPP_WIN32_AVAILABLE)
0124 
0125     #if defined(CRYPTOPP_EXPORTS)
0126     #  define CRYPTOPP_IS_DLL
0127     #  define CRYPTOPP_DLL __declspec(dllexport)
0128     #elif defined(CRYPTOPP_IMPORTS)
0129     #  define CRYPTOPP_IS_DLL
0130     #  define CRYPTOPP_DLL __declspec(dllimport)
0131     #else
0132     #  define CRYPTOPP_DLL
0133     #endif
0134 
0135     // C++ makes const internal linkage

0136     #define CRYPTOPP_TABLE extern
0137     #define CRYPTOPP_API __cdecl
0138 
0139 #else   // not CRYPTOPP_WIN32_AVAILABLE

0140 
0141     // C++ makes const internal linkage

0142     #define CRYPTOPP_TABLE extern
0143     #define CRYPTOPP_DLL
0144     #define CRYPTOPP_API
0145 
0146 #endif  // CRYPTOPP_WIN32_AVAILABLE

0147 
0148 #if defined(__MWERKS__)
0149 #  define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
0150 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
0151 #  define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
0152 #else
0153 #  define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
0154 #endif
0155 
0156 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
0157 #  define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
0158 #else
0159 #  define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
0160 #endif
0161 
0162 #if defined(__MWERKS__)
0163 #  define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
0164 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
0165 #  define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
0166 #else
0167 #  define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
0168 #endif
0169 
0170 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
0171 #  define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
0172 #else
0173 #  define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
0174 #endif
0175 
0176 #endif  // CRYPTOPP_DOXYGEN_PROCESSING

0177 
0178 #endif  // CRYPTOPP_CONFIG_DLL_H