Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-5348

Redefinition of macros while using the C++ driver makes it unusable with larger application code

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.0.5, 2.1.1
    • Affects Version/s: None
    • Component/s: Internal Client
    • None
    • Environment:
      5d3433eb31a58a4fcd242f8a0437819f63df723e
    • Fully Compatible
    • ALL

      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?

      1. 1 "/home/piotr/devel/mmcc_mongodb/3rd-party/mongodb/src/mongo/client/../util/allocator.h" 1
      2. 18 "/home/piotr/devel/mmcc_mongodb/3rd-party/mongodb/src/mongo/client/../util/allocator.h"

      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
      #define malloc MONGO_malloc

            Assignee:
            milkie@mongodb.com Eric Milkie
            Reporter:
            piotr Pedro Larroy
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: