Scine::Sparrow  5.0.0
Library for fast and agile quantum chemical calculations with semiempirical methods.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
SparrowModule.h
Go to the documentation of this file.
1 
7 #ifndef SPARROW_SPARROWMODULE_H_
8 #define SPARROW_SPARROWMODULE_H_
9 
10 /* External Includes */
11 
12 #include <Core/Module.h>
13 #include <boost/dll/alias.hpp>
14 #include <memory>
15 
16 namespace Scine {
17 namespace Sparrow {
18 
24  public:
25  std::string name() const noexcept final;
26 
27  boost::any get(const std::string& interface, const std::string& model) const final;
28 
29  bool has(const std::string& interface, const std::string& model) const noexcept final;
30 
31  std::vector<std::string> announceInterfaces() const noexcept final;
32 
33  std::vector<std::string> announceModels(const std::string& interface) const noexcept final;
34 
35  static std::shared_ptr<Module> make();
36 };
37 
38 std::vector<std::shared_ptr<Core::Module>> moduleFactory();
39 
40 } /* namespace Sparrow */
41 } /* namespace Scine */
42 
43 #ifdef __MINGW32__
44 /* MinGW builds are problematic. We build with default visibility, and adding
45  * an attribute __dllexport__ specifically for this singular symbol leads to the
46  * loss of all other weak symbols. Essentially, here we have just expanded the
47  * BOOST_DLL_ALIAS macro in order to declare the type-erased const void*
48  * 'moduleFactory' without any symbol visibility attribute additions that could
49  * confuse the MinGW linker, which per Boost DLL documentation is unable to mix
50  * weak attributes and __dllexport__ correctly.
51  *
52  * If ever the default visibility for this translation unit is changed, we
53  * will have to revisit this bit of code for the MinGW platform again.
54  *
55  * Additionally, more recent Boost releases may have fixed this problem.
56  * See the macro BOOST_DLL_FORCE_ALIAS_INSTANTIATIONS as used in the library's
57  * example files.
58  */
59 extern "C" {
60 const void* moduleFactory = reinterpret_cast<const void*>(reinterpret_cast<intptr_t>(&Scine::Sparrow::moduleFactory));
61 }
62 #else
63 BOOST_DLL_ALIAS(Scine::Sparrow::moduleFactory, moduleFactory)
64 #endif
65 
66 #endif /* SPARROW_SPARROWMODULE_H_ */
The SCINE Module implementation for Sparrow.
Definition: SparrowModule.h:23