Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1224

mongocxx::client constructor fails on Windows 7

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.3
    • Component/s: Portability
    • None
    • Environment:
      Windows 7, 32 bit binary, 64 bit OS

      Basically, if I try to use the simple mongo client data structure listed in the tutorial, I get a hard crash in Windows 7.

      This is my fully-contained working example that demonstrates the issue:
      ```
      #include <cstdint>
      #include <iostream>
      #include <vector>

      #include <bsoncxx/json.hpp>
      #include <mongocxx/client.hpp>
      #include <mongocxx/stdx.hpp>
      #include <mongocxx/uri.hpp>

      using bsoncxx::builder::stream::close_array;
      using bsoncxx::builder::stream::close_document;
      using bsoncxx::builder::stream::document;
      using bsoncxx::builder::stream::finalize;
      using bsoncxx::builder::stream::open_array;
      using bsoncxx::builder::stream::open_document;

      int main(void)
      {
      try {

      mongocxx::uri uri("mongodb://localhost:27017");
      // this is what's failing
      mongocxx::client client

      { uri }

      ;
      }
      catch (std::exception err)

      { std::cout << err.what() << "\n"; }

      return 0;
      }
      ```

      It seems like it's an issue deep in the Mongo callstack:
      > libmongoc-1.0.dll!_InterlockedExchangeAdd64(volatile __int64 * Addend, __int64 Value) Line 5603 C

      Namely, this line here:
      ```
      do

      { // this one is what VS picks up on Old = *Addend; }

      while (InterlockedCompareExchange64(Addend,
      Old + Value,
      Old) != Old);
      ```

      I installed the mongo-cxx-driver using vcpkg as well.

            Assignee:
            david.golden@mongodb.com David Golden
            Reporter:
            exbigboss Christian Mazakas
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: