17
17
18
18
#ifdef DOCOPT_HEADER_ONLY
19
19
#define DOCOPT_INLINE inline
20
- #define DOCOPTAPI
20
+ #define DOCOPT_API
21
21
#else
22
22
#define DOCOPT_INLINE
23
23
24
- // On Windows, export certain symbols so they are available
25
- // to users of docopt.dll (shared library).
26
- #ifdef WIN32
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.
27
33
#ifdef DOCOPT_EXPORTS
28
- #define DOCOPTAPI __declspec (dllexport)
34
+ #define DOCOPT_API __declspec (dllexport)
29
35
#else
30
- #define DOCOPTAPI __declspec (dllimport)
36
+ #define DOCOPT_API __declspec (dllimport)
31
37
#endif
32
38
#else
33
- #define DOCOPTAPI
39
+ #define DOCOPT_API
34
40
#endif
35
41
#endif
36
42
@@ -61,7 +67,7 @@ namespace docopt {
61
67
// / @throws DocoptExitHelp if 'help' is true and the user has passed the '--help' argument
62
68
// / @throws DocoptExitVersion if 'version' is true and the user has passed the '--version' argument
63
69
// / @throws DocoptArgumentError if the user's argv did not match the usage patterns
64
- std::map<std::string, value> DOCOPTAPI docopt_parse (std::string const & doc,
70
+ std::map<std::string, value> DOCOPT_API docopt_parse (std::string const & doc,
65
71
std::vector<std::string> const & argv,
66
72
bool help = true ,
67
73
bool version = true ,
@@ -74,7 +80,7 @@ namespace docopt {
74
80
// / * DocoptExitHelp - print usage string and terminate (with exit code 0)
75
81
// / * DocoptExitVersion - print version and terminate (with exit code 0)
76
82
// / * DocoptArgumentError - print error and usage string and terminate (with exit code -1)
77
- std::map<std::string, value> DOCOPTAPI docopt (std::string const & doc,
83
+ std::map<std::string, value> DOCOPT_API docopt (std::string const & doc,
78
84
std::vector<std::string> const & argv,
79
85
bool help = true ,
80
86
std::string const & version = {},
0 commit comments