16
16
#include < string>
17
17
18
18
#ifdef DOCOPT_HEADER_ONLY
19
- #define DOCOPT_INLINE inline
19
+ #define DOCOPT_INLINE inline
20
+ #define DOCOPTAPI
20
21
#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
22
35
#endif
23
36
24
37
namespace docopt {
@@ -48,7 +61,7 @@ namespace docopt {
48
61
// / @throws DocoptExitHelp if 'help' is true and the user has passed the '--help' argument
49
62
// / @throws DocoptExitVersion if 'version' is true and the user has passed the '--version' argument
50
63
// / @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,
52
65
std::vector<std::string> const & argv,
53
66
bool help = true ,
54
67
bool version = true ,
@@ -61,15 +74,15 @@ namespace docopt {
61
74
// / * DocoptExitHelp - print usage string and terminate (with exit code 0)
62
75
// / * DocoptExitVersion - print version and terminate (with exit code 0)
63
76
// / * 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,
65
78
std::vector<std::string> const & argv,
66
79
bool help = true ,
67
80
std::string const & version = {},
68
81
bool options_first = false ) noexcept ;
69
82
}
70
83
71
84
#ifdef DOCOPT_HEADER_ONLY
72
- #include " docopt.cpp"
85
+ #include " docopt.cpp"
73
86
#endif
74
87
75
88
#endif /* defined(docopt__docopt_h_) */
0 commit comments