[SERVER-5348] Redefinition of macros while using the C++ driver makes it unusable with larger application code Created: 21/Mar/12 Updated: 05/Nov/15 Resolved: 03/Apr/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Client |
| Affects Version/s: | None |
| Fix Version/s: | 2.0.5, 2.1.1 |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Pedro Larroy | Assignee: | Eric Milkie |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
5d3433eb31a58a4fcd242f8a0437819f63df723e |
||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
when including the C++ driver, some important system calls and macros like 'assert' and 'malloc' get redefined ant not defined back into the original state. Makes using the C++ driver unusable as part of a larger application. Will patches to fix this behaviour be accepted?
namespace mongo { inline void * ourmalloc(size_t size) { void *x = malloc(size); if ( x == 0 ) dbexit( EXIT_OOM_MALLOC , "malloc fails"); return x; }inline void * ourrealloc(void *ptr, size_t size) { void *x = realloc(ptr, size); if ( x == 0 ) dbexit( EXIT_OOM_REALLOC , "realloc fails"); return x; }#define MONGO_malloc mongo::ourmalloc |
| Comments |
| Comment by auto [ 18/Apr/12 ] |
|
Author: {u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}Message: |
| Comment by auto [ 18/Apr/12 ] |
|
Author: {u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}Message: |
| Comment by auto [ 18/Apr/12 ] |
|
Author: {u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}Message: |
| Comment by auto [ 18/Apr/12 ] |
|
Author: {u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}Message: |
| Comment by auto [ 18/Apr/12 ] |
|
Author: {u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}Message: |
| Comment by Eric Milkie [ 03/Apr/12 ] |
|
C RTL functions like 'assert' and 'malloc' are no longer redefined by the C++ driver headers. All C++ driver use has been consolidated into one master header, dbclient.h. No other headers need be included. |
| Comment by auto [ 02/Apr/12 ] |
|
Author: {u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}Message: |
| Comment by auto [ 02/Apr/12 ] |
|
Author: {u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}Message: This change fixes some #defines of common C functions so that their |
| Comment by auto [ 23/Mar/12 ] |
|
Author: {u'login': u'larroy', u'name': u'Pedro Larroy', u'email': u'pedro.larroy@gmail.com'}Message: Signed-off-by: Eric Milkie <milkie@10gen.com> |
| Comment by Pedro Larroy [ 23/Mar/12 ] |
|
Created a new pull request: https://github.com/mongodb/mongo/pull/193 |
| Comment by Pedro Larroy [ 23/Mar/12 ] |
|
The change is done, can you please integrate it? |
| Comment by Eric Milkie [ 22/Mar/12 ] |
|
I commented on your pull request. I can merge it in after you make the suggested change. |
| Comment by auto [ 22/Mar/12 ] |
|
Author: {u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}Message: |
| Comment by Pedro Larroy [ 22/Mar/12 ] |
|
Done. |
| Comment by Eric Milkie [ 21/Mar/12 ] |
|
Hi Pedro, |
| Comment by Pedro Larroy [ 21/Mar/12 ] |
|
Created pull request: https://github.com/mongodb/mongo/pull/191 Please apply. |