1616#include < string>
1717
1818#ifdef DOCOPT_HEADER_ONLY
19- #define DOCOPT_INLINE inline
19+ #define DOCOPT_INLINE inline
20+ #define DOCOPTAPI
2021#else
21- #define DOCOPT_INLINE
22+ #define DOCOPT_INLINE
23+
24+ // On Windows, export certain symbols so they are available
25+ // to users of docopt.dll (shared library).
26+ #ifdef WIN32
27+ #ifdef DOCOPT_EXPORTS
28+ #define DOCOPTAPI __declspec (dllexport)
29+ #else
30+ #define DOCOPTAPI __declspec (dllimport)
31+ #endif
32+ #else
33+ #define DOCOPTAPI
34+ #endif
2235#endif
2336
2437namespace docopt {
@@ -48,7 +61,7 @@ namespace docopt {
4861 // / @throws DocoptExitHelp if 'help' is true and the user has passed the '--help' argument
4962 // / @throws DocoptExitVersion if 'version' is true and the user has passed the '--version' argument
5063 // / @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,
64+ std::map<std::string, value> DOCOPTAPI docopt_parse (std::string const & doc,
5265 std::vector<std::string> const & argv,
5366 bool help = true ,
5467 bool version = true ,
@@ -61,15 +74,15 @@ namespace docopt {
6174 // / * DocoptExitHelp - print usage string and terminate (with exit code 0)
6275 // / * DocoptExitVersion - print version and terminate (with exit code 0)
6376 // / * DocoptArgumentError - print error and usage string and terminate (with exit code -1)
64- std::map<std::string, value> docopt (std::string const & doc,
77+ std::map<std::string, value> DOCOPTAPI docopt (std::string const & doc,
6578 std::vector<std::string> const & argv,
6679 bool help = true ,
6780 std::string const & version = {},
6881 bool options_first = false ) noexcept ;
6982}
7083
7184#ifdef DOCOPT_HEADER_ONLY
72- #include " docopt.cpp"
85+ #include " docopt.cpp"
7386#endif
7487
7588#endif /* defined(docopt__docopt_h_) */
0 commit comments