5

I am trying to create a circular buffer in shared memory using Boost circular_buffer and Interprocess libraries. I compiled and ran the the example given in the Interprocess documentation for creating a vector in shared memory with no problem. However, when I modify it to use the Boost circular_buffer as:

int main(int argc, char *argv[])
{
    managed_shared_memory segment(create_only, "MySharedMemory", 65536);
    const ShmemAllocator alloc_inst (segment.get_segment_manager());
    MyCircBuffer  *myCircBuf  = segment.construct<MyCircBuffer>("MyCircBuffer")(alloc_inst);
    return 0;
} 

I get a compilation error (caused by segment.construct()). Any idea what I am doing wrong? Is it because circular_buffer is not one of the containers listed in /boost/interprocess/containers, i.e. it's not compatible with Interprocess?

Thanks,

C

Community
  • 1
  • 1
recipriversexclusion
  • 13,448
  • 6
  • 34
  • 45
  • 2
    can you provide the compilation error message? – John Weldon Feb 25 '10 at 04:26
  • 1
    Please post the error list and compiler... – rlbond Feb 25 '10 at 04:27
  • Sorry for not giving all the details. The error I get is /usr/local/include/boost/circular_buffer/base.hpp:2127: error: cannot convert ‘boost::interprocess::offset_ptr’ to ‘void*’ for argument ‘1’ to ‘void* memset(void*, int, size_t)’ I'm using gcc v4.2.1 on MAc OS X – recipriversexclusion Feb 25 '10 at 16:32

1 Answers1

4

I asked the same question on the boost user forum and the solution that was suggested was to use -DBOOST_CB_DISABLE_DEBUG or -DNDEBUG flags, since circular_buffer relies on raw pointers for debug support.

Any other suggestions?

recipriversexclusion
  • 13,448
  • 6
  • 34
  • 45