16
16
#include < string>
17
17
18
18
#ifdef DOCOPT_HEADER_ONLY
19
- #define DOCOPT_INLINE inline
19
+ #define DOCOPT_INLINE inline
20
+ #define DOCOPT_API
20
21
#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
22
41
#endif
23
42
24
43
namespace docopt {
@@ -48,7 +67,7 @@ namespace docopt {
48
67
// / @throws DocoptExitHelp if 'help' is true and the user has passed the '--help' argument
49
68
// / @throws DocoptExitVersion if 'version' is true and the user has passed the '--version' argument
50
69
// / @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,
52
71
std::vector<std::string> const & argv,
53
72
bool help = true ,
54
73
bool version = true ,
@@ -61,7 +80,7 @@ namespace docopt {
61
80
// / * DocoptExitHelp - print usage string and terminate (with exit code 0)
62
81
// / * DocoptExitVersion - print version and terminate (with exit code 0)
63
82
// / * 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,
65
84
std::vector<std::string> const & argv,
66
85
bool help = true ,
67
86
std::string const & version = {},
0 commit comments