Skip to content

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

Merged
merged 7 commits into from
Jul 3, 2015
Merged

Msvc fixes #60

merged 7 commits into from
Jul 3, 2015

Conversation

cmbrandenburg
Copy link
Contributor

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-class dllexport declarations with classes that contain STL members, such as std::string.

Craig M. Brandenburg added 5 commits June 29, 2015 16:16
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.
@glynos
Copy link
Member

glynos commented Jul 2, 2015

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.

Craig M. Brandenburg added 2 commits July 2, 2015 12:14
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.
@cmbrandenburg
Copy link
Contributor Author

I reverted the per-member dllexport declarations to be per-class again. This follows the Boost guidelines, where the key is disabling compiler warnings with #pragma.

The resulting pull request has gotten a tad messy, what with all the commits, some undoing others. You may want to squash the merge.

glynos added a commit that referenced this pull request Jul 3, 2015
@glynos glynos merged commit 4e2ea55 into cpp-netlib:master Jul 3, 2015
@glynos
Copy link
Member

glynos commented Jul 3, 2015

I am happy with the changes as they are. Many thanks for your contribution!

@cmbrandenburg
Copy link
Contributor Author

Thank you for making this library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants