1616#include < string>
1717
1818#ifdef DOCOPT_HEADER_ONLY
19- #define DOCOPT_INLINE inline
19+ #define DOCOPT_INLINE inline
20+ #define DOCOPT_API
2021#else
21- #define DOCOPT_INLINE
22+ #define DOCOPT_INLINE
23+
24+ // With Microsoft Visual Studio, export certain symbols so they
25+ // are available to users of docopt.dll (shared library). The DOCOPT_DLL
26+ // macro should be defined if building a DLL (with Visual Studio),
27+ // and by clients using the DLL. The CMakeLists.txt and the
28+ // docopt-config.cmake it generates handle this.
29+ #ifdef DOCOPT_DLL
30+ // Whoever is *building* the DLL should define DOCOPT_EXPORTS.
31+ // The CMakeLists.txt that comes with docopt does this.
32+ // Clients of docopt.dll should NOT define DOCOPT_EXPORTS.
33+ #ifdef DOCOPT_EXPORTS
34+ #define DOCOPT_API __declspec (dllexport)
35+ #else
36+ #define DOCOPT_API __declspec (dllimport)
37+ #endif
38+ #else
39+ #define DOCOPT_API
40+ #endif
2241#endif
2342
2443namespace docopt {
@@ -48,7 +67,7 @@ namespace docopt {
4867 // / @throws DocoptExitHelp if 'help' is true and the user has passed the '--help' argument
4968 // / @throws DocoptExitVersion if 'version' is true and the user has passed the '--version' argument
5069 // / @throws DocoptArgumentError if the user's argv did not match the usage patterns
51- std::map<std::string, value> docopt_parse (std::string const & doc,
70+ std::map<std::string, value> DOCOPT_API docopt_parse (std::string const & doc,
5271 std::vector<std::string> const & argv,
5372 bool help = true ,
5473 bool version = true ,
@@ -61,7 +80,7 @@ namespace docopt {
6180 // / * DocoptExitHelp - print usage string and terminate (with exit code 0)
6281 // / * DocoptExitVersion - print version and terminate (with exit code 0)
6382 // / * DocoptArgumentError - print error and usage string and terminate (with exit code -1)
64- std::map<std::string, value> docopt (std::string const & doc,
83+ std::map<std::string, value> DOCOPT_API docopt (std::string const & doc,
6584 std::vector<std::string> const & argv,
6685 bool help = true ,
6786 std::string const & version = {},
0 commit comments