-
Notifications
You must be signed in to change notification settings - Fork 73
Msvc fixes #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Msvc fixes #60
Conversation
Define `BOOST_ALL_DYN_LINK` when building as a shared library using Visual Studio. Without this definition, the Boost auto-linking feature links to the Boost static libraries. Set `NETWORK_URI_DECL` to `BOOST_SYMBOL_IMPORT` when using the library instead of building it. This definition expands to `__dllspec(dllimport)`, which is required to use the shared library in Visual Studio.
This commit removes the `NETWORK_URI_DECL` declaration from all classes using it and instead applies the declaration to individual functions and member functions that need it. The problem with applying the declaration per class is that it causes compiler warnings when using Visual Studio--both when building the library and when using the library from another project.
Hi Craig, Thanks for doing this. But I have a question: you say that it's not a good idea to mix per-class dllexport declarations with classes that contain STL members. Do you have a link to something that explains this? It's interesting you say it because I have usually have seen the dllexport declarations made per-class. I'm not normally a Windows programming guy, so I don't fully know all the subtleties. |
This commits reverts the per-member dllexport/dllimport declarations to be per-class for the `uri` and `uri_builder` classes, adding pragmas to disable compiler warnings as necessary. This follows the Boost guidelines (http://www.boost.org/development/separate_compilation.html). The URI exception classes' declarations remain per-member because otherwise their base class, `std::system_error`, would need to be exported.
I reverted the per-member The resulting pull request has gotten a tad messy, what with all the commits, some undoing others. You may want to squash the merge. |
I am happy with the changes as they are. Many thanks for your contribution! |
Thank you for making this library! |
This branch fixes several problems, all of which I encountered getting the library up-and-running as a DLL using Visual Studio. One of those problems was Issue #48, so there's a fix for that in this pull request.
This pull request also includes a fix for a couple of mischievous
#include
statements that made it hard to run an automatic amalgamator on the URI library.The other fixes should be clear. One change is converting the
dllexport
declaration from per-class to per-function. This eliminates compiler warnings when building or using the library. Apparently it's not a good idea to mix per-classdllexport
declarations with classes that contain STL members, such asstd::string
.