[CXX-1224] mongocxx::client constructor fails on Windows 7 Created: 17/Feb/17 Updated: 27/Oct/23 Resolved: 21/Feb/17 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | Portability |
| Affects Version/s: | 3.0.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Christian Mazakas | Assignee: | David Golden |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 7, 32 bit binary, 64 bit OS |
||
| Issue Links: |
|
||||||||||||
| Description |
|
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 <bsoncxx/json.hpp> using bsoncxx::builder::stream::close_array; int main(void) mongocxx::uri uri("mongodb://localhost:27017"); ; return 0; It seems like it's an issue deep in the Mongo callstack: Namely, this line here: while (InterlockedCompareExchange64(Addend, I installed the mongo-cxx-driver using vcpkg as well. |
| Comments |
| Comment by David Golden [ 21/Feb/17 ] |
|
I'm glad you figured it out. As you can see from related tickets, we know this is something we could make more user-friendly. |
| Comment by Christian Mazakas [ 21/Feb/17 ] |
|
Okay, turns out that I'm a super duper dummy. All I had to do was revert the expression `mongocxx::instance{}` into `mongocxx::instance instance{}` and the code works beautifully. Basically, the instance stuff isn't mentioned that much in the tutorials nor is it mentioned what the lifetime of it needs to be. Ideally the code should throw a useful exception instead of having a segmentation fault which is what it was basically doing for me. But the MongoDB C++ driver is amazing and I appreciate all the hard work that goes into it. |