[CXX-60] Default Windows builds of the C++ client driver to use /MD Created: 19/Feb/14  Updated: 04/May/14  Resolved: 22/Apr/14

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: None
Fix Version/s: legacy-0.8.0

Type: Improvement Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: legacy-cxx, windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CXX-96 Enforce /MD with Windows C++ DLL driver Closed

 Description   

Since the windows driver will only be buildable as a DLL (see CXX-59), it makes no sense for that DLL to link the static runtime. The build system should always use the dynamic runtime when building the driver on windows.



 Comments   
Comment by Githook User [ 22/Apr/14 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: CXX-60 Place warning descriptions inline
Branch: legacy
https://github.com/mongodb/mongo-cxx-driver/commit/356541657a01848696b934e21c0c917604310020

Comment by Githook User [ 22/Apr/14 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: CXX-60 Require non-static consumers to link the dynamic runtime

Also, suppress build and consume time warnings for DLL export STL
issues and a drive-by consume suppression of CRT security warnings
Branch: legacy
https://github.com/mongodb/mongo-cxx-driver/commit/942c381397a8cf72ae5619ee83bd3d78ea9b99e1

Comment by Andrew Morrow (Inactive) [ 21/Apr/14 ]

https://github.com/mongodb/mongo-cxx-driver/pull/59

Comment by Andrew Morrow (Inactive) [ 21/Apr/14 ]

Right, those should say /MD and /MDd. Lack of MSDN is a serious pain today.

Comment by Eric Milkie [ 21/Apr/14 ]

I'm not sure that code example's error message is correct – /MT does not set _DLL, although /MD does. I think...
(MSDN is down right now, every page results in "Sorry, this page is unavailable. Please try again later.")

Comment by Andrew Morrow (Inactive) [ 21/Apr/14 ]

We have STATIC_LIBMONGOCLIENT now, which lets us know if the consumer is intending to build against a static version of the client library. So I think we can add our _DLL check conditioned on the status of STATIC_LIBMONGOCLIENT.

In bson.h and dbclient.h:

#if defined(_WIN32) && !defined(STATIC_LIBMONGOCLIENT) && !defined(_DLL)
#error "Using the DLL build of libmongoclient requires consuming code to be built with /MT or /MTd"
#endif

Comment by Eric Milkie [ 19/Feb/14 ]

Option: use /MDd in debug mode.

Also, we should check the compilation mode in a common header – ensure that _DLL is defined, so that a consumer of the driver cannot compile the header without /MD[d].

Generated at Wed Feb 07 21:58:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.