Closed chrisdembia closed 8 years ago
Looks ok to me but I know nothing about Windows :) This has been up a week and no one has objected so let's merge it.
Thank you! I will be happy to address any issues that arise from this PR.
Thanks for your contributions!
And thank you for making a great library :)
In PR #60, I tried to improve support for using docopt with Visual Studio when building/using the shared library
docopt.dll
. In doing so, I introduced a bug when trying to build/use docopt as a static library (docopt_s.lib
) in Visual Studio.Basically, I had been defining
DOCOPTAPI
to be__declspec(dllimport)
when building the static library. But when building a static library, neither__declspec(dllimport)
nor__declspec(dllexport)
should be used.This PR fixes the bug. The new behavior is as follows. When building the shared library, one must define both
DOCOPT_DLL
andDOCOPT_API
. When using the shared library, one must defineDOCOPT_DLL
. The user need not worry about these macros at all; they are handled by CMake. For example, a client project with the following CMakeLists.txt will causeDOCOPT_DLL
to automatically be defined when compilingfoo.cpp
.Locally, I tested both the shared library
docopt.dll
and the static librarydocopt_s.lib
with a small CMake client project.