<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:58:11 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CXX-96] Enforce /MD with Windows C++ DLL driver</title>
                <link>https://jira.mongodb.org/browse/CXX-96</link>
                <project id="11980" key="CXX">C++ Driver</project>
                    <description>&lt;p&gt;In order to prevent build mistakes, the C++ driver should ensure that _MD is defined, since we are compiling the shared library with /MD.  This ensures that the same C RTL (and thus the same heap) is used across all translation units between the mongo library and the client code:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;#if( !defined(_MD) )&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;#error _MD is not defined&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;#endif&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;We&apos;re already doing this in version.cpp, but of course this code isn&apos;t hit by consumers of the C++ driver.  It needs to be in a header.&lt;/p&gt;

&lt;p&gt;&lt;del&gt;Also, confusingly, we are using /MDd for debug mode; I think this ought to be /MTd, since we&apos;re not building a DLL.  This could cause weirdness if driver developers didn&apos;t also use /MDd.&lt;/del&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="32285">CXX-96</key>
            <summary>Enforce /MD with Windows C++ DLL driver</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="milkie@mongodb.com">Eric Milkie</reporter>
                        <labels>
                            <label>cxxmove</label>
                            <label>legacy-cxx</label>
                            <label>windows</label>
                    </labels>
                <created>Mon, 5 Mar 2012 21:31:15 +0000</created>
                <updated>Mon, 8 Jan 2024 15:30:25 +0000</updated>
                            <resolved>Mon, 21 Apr 2014 16:08:15 +0000</resolved>
                                                    <fixVersion>legacy-0.8.0</fixVersion>
                                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="557540" author="acm" created="Mon, 21 Apr 2014 16:08:15 +0000"  >&lt;p&gt;See notes above. This ticket was intending to restrict to only building the driver as a dll and ensuring that clients consume the driver appropriately. However, we now permit building the driver as a static library, and there are other tickets (&lt;a href=&quot;https://jira.mongodb.org/browse/CXX-60&quot; title=&quot;Default Windows builds of the C++ client driver to use /MD&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-60&quot;&gt;&lt;del&gt;CXX-60&lt;/del&gt;&lt;/a&gt; and &lt;a href=&quot;https://jira.mongodb.org/browse/CXX-138&quot; title=&quot;For windows builds, consider producing two DLLs, one linked to the debug runtime, with different names&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-138&quot;&gt;&lt;del&gt;CXX-138&lt;/del&gt;&lt;/a&gt;) that better cover the behavior we want to enforce.&lt;/p&gt;</comment>
                            <comment id="557531" author="milkie" created="Mon, 21 Apr 2014 16:01:08 +0000"  >&lt;p&gt;We should be enforcing that the library you link with your application was compiled the same way as your own application. But that is somewhat covered by other tickets.  So I think closing this as WontFix is the right thing to do here.&lt;/p&gt;</comment>
                            <comment id="557521" author="acm" created="Mon, 21 Apr 2014 15:51:49 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=milkie&quot; class=&quot;user-hover&quot; rel=&quot;milkie&quot;&gt;milkie&lt;/a&gt; I think we should close this as wont fix. &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=mira.carey%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;mira.carey@mongodb.com&quot;&gt;mira.carey@mongodb.com&lt;/a&gt; made it so that the static windows library works via some cool initializer related magic, so we can now build in both modes, and we don&apos;t really want to force this. Do you agree? Also, I don&apos;t think _MD is really a thing, reading this: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=vs.120).aspx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=vs.120).aspx&lt;/a&gt;. There is _MT, but that is about threading, not static/dynamic runtime.&lt;/p&gt;

&lt;p&gt;There is also &lt;a href=&quot;https://jira.mongodb.org/browse/CXX-60&quot; title=&quot;Default Windows builds of the C++ client driver to use /MD&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-60&quot;&gt;&lt;del&gt;CXX-60&lt;/del&gt;&lt;/a&gt;, which is asking to enforce _DLL. I think we should do that, and can, since we now have STATIC_LIBMOGNOCLIENT to let us know whether the client has explicitly asked for a static lib and then suppress the _DLL check. I&apos;ll write up more in &lt;a href=&quot;https://jira.mongodb.org/browse/CXX-60&quot; title=&quot;Default Windows builds of the C++ client driver to use /MD&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-60&quot;&gt;&lt;del&gt;CXX-60&lt;/del&gt;&lt;/a&gt; and we can see what we think.&lt;/p&gt;

&lt;p&gt;Long term, I think the driver should move to a multi-build model where it emits several windows variant libraries, probably following the boost naming convention, so a build would get:&lt;/p&gt;

&lt;p&gt;mongoclient.lib&lt;br/&gt;
mongoclient.dll&lt;br/&gt;
mongoclient-gd.lib&lt;br/&gt;
mongoclient-gd.dll&lt;br/&gt;
libmongoclient.lib&lt;br/&gt;
libmongoclient-gd.lib&lt;br/&gt;
libmongoclient-s.lib&lt;br/&gt;
libmongoclient-sgd.lib&lt;/p&gt;

&lt;p&gt;However this is a fairly substantial overhaul of the build system, and is tracked in &lt;a href=&quot;https://jira.mongodb.org/browse/CXX-138&quot; title=&quot;For windows builds, consider producing two DLLs, one linked to the debug runtime, with different names&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-138&quot;&gt;&lt;del&gt;CXX-138&lt;/del&gt;&lt;/a&gt;, so I will add notes to that.&lt;/p&gt;</comment>
                            <comment id="469686" author="xgen-internal-githook" created="Thu, 12 Dec 2013 00:08:00 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;andy10gen&apos;, u&apos;name&apos;: u&apos;Andy Schwerin&apos;, u&apos;email&apos;: u&apos;schwerin@10gen.com&apos;}
&lt;p&gt;Message: Revert &quot;&lt;a href=&quot;https://jira.mongodb.org/browse/CXX-96&quot; title=&quot;Enforce /MD with Windows C++ DLL driver&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-96&quot;&gt;&lt;del&gt;SERVER-5214&lt;/del&gt;&lt;/a&gt; Require Windows C++ driver consumers to link against the DLL version of the C++ runtime.&quot;&lt;/p&gt;

&lt;p&gt;This reverts commit aac9e25fb096234bed6ea48217651a05afa9e10e, which currently&lt;br/&gt;
breaks the Windows build.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/172bf6a4e24a65da9a6269507c2385c797d35cb7&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/172bf6a4e24a65da9a6269507c2385c797d35cb7&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="469302" author="xgen-internal-githook" created="Wed, 11 Dec 2013 16:43:50 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;andy10gen&apos;, u&apos;name&apos;: u&apos;Andy Schwerin&apos;, u&apos;email&apos;: u&apos;schwerin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CXX-96&quot; title=&quot;Enforce /MD with Windows C++ DLL driver&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-96&quot;&gt;&lt;del&gt;SERVER-5214&lt;/del&gt;&lt;/a&gt; Require Windows C++ driver consumers to link against the DLL version of the C++ runtime.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/aac9e25fb096234bed6ea48217651a05afa9e10e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/aac9e25fb096234bed6ea48217651a05afa9e10e&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="151417" author="siedler" created="Wed, 8 Aug 2012 03:53:56 +0000"  >&lt;p&gt;I &lt;b&gt;very&lt;/b&gt; &lt;b&gt;strongly&lt;/b&gt; agree with Tad.&lt;/p&gt;

&lt;p&gt;BTW, _MT is always defined for native code. It indicates a multithreaded C/C++ runtime, which is always the case since VS2008. &lt;br/&gt;
And I hope that this means that I can compile mongod with /MD - a dll crt is serviceable by windows update, as has happened many times due to security fixes.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/abx4dbyh%28v=vs.90%29.aspx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://msdn.microsoft.com/en-us/library/abx4dbyh%28v=vs.90%29.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And then there is this managed/mixed code thing.&lt;/p&gt;</comment>
                            <comment id="96651" author="milkie" created="Thu, 8 Mar 2012 01:51:50 +0000"  >&lt;p&gt;I found this on the C++ driver wiki page:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Windows Troubleshooting&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;error LNK2005: ___ already defined in msvcprt.lib(MSVCP100.dll) libboost_thread-vc100-mt-1_42.lib(thread.obj)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;The boost library being linked against is expecting a /MT build. If this is a release build, try using /MT instead of /MD for compilation (under Properties.C++.Code Generation).&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;With the changes proposed in this ticket, we could expunge this embarrassing error and do away with documenting its explanation.&lt;/p&gt;</comment>
                            <comment id="95574" author="milkie" created="Mon, 5 Mar 2012 22:49:43 +0000"  >&lt;p&gt;(Also, note that /MT is the default, so if you don&apos;t specify anything on the command line, that is what you get.)&lt;/p&gt;</comment>
                            <comment id="95572" author="milkie" created="Mon, 5 Mar 2012 22:45:43 +0000"  >&lt;p&gt;Is it in our best interests to make it easy to accidentally build the C++ driver using incorrect flags, and thus have it result in odd runtime behavior?  There&apos;s a line somewhere here.  I can&apos;t think of a good reason why anyone would mix the flags, and I think it&apos;s very easy for an unsuspecting user to mess it up.  Even our own build tool isn&apos;t doing it right.&lt;/p&gt;</comment>
                            <comment id="95556" author="tad" created="Mon, 5 Mar 2012 22:17:38 +0000"  >&lt;p&gt;I vote against things placed in the code that say that you can&apos;t build it any way but our way.  In my experience, developers may need to adapt code to fit the project they are working on, and if they have to change our header files to use MongoDB then this is not in our best interests.  Once users have to modify our source code, they will become reluctant to stay current with our changes ... not what we want.&lt;/p&gt;

&lt;p&gt;The incorrect use of /MDd in our own builds can be addressed separately.  I agree with that part ... if the release build is compiled with a static CRT, then the debug build should be compiled with a static CRT.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="76370">SERVER-9770</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="111953">CXX-60</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="120271">CXX-138</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hriatj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>20398</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>