docopt / docopt.cpp

C++11 port of docopt
Boost Software License 1.0
1.05k stars 146 forks source link

`WIN32` definition for creating DLLs on Windows is somewhat misleading #63

Closed blandcr closed 8 years ago

blandcr commented 8 years ago

The PR that added WIN32 dllimport/dllexport stuff inadvertently seems to have broken static linking with docopt_s if you have WIN32 defined.

The problem seems to be with symbols being tagged with dllexport/dllimport due to the WIN32 flag being defined.

The problem is exhibited on my setup: using CMake with -G"Visual Studio 14 2015 Win64" -TLLVM-vs2014 arguments (so clang 3.9.0 toolset and using msbuild/visual studio to build)

I am unsure if the same problem is exhibited when building with cl.

I think a good resolution is maybe changing the WIN32 flag to be named something a little more obvious like WIN32_DLL or something and providing some documentation regarding it in the CMakeLists.txt and Readme.rst file.

If you want I could write up a quick blurb and do some more testing to verify whether this happens when using cl or not and submit a PR Just let me know!

jaredgrubb commented 8 years ago

I just made a merge of a patch that adjusted this a bit .. can you take a look and see if this addresses your issue or if there is still something to do? https://github.com/docopt/docopt.cpp/pull/61

blandcr commented 8 years ago

61 solved the issue I was seeing. Thanks!