Problem creating a circular buffer in shared memory using Boost

Hi, 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 documentationhttp://www.boost.org/doc/libs/1_42_0/doc/html/interprocess/quick_guide.html#...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

Hi Cuneyt,
the circular buffer should be compatible with Interprocess - the only 'problem' is that the circular buffer's debug support relies on 'raw' pointers. Try compiling with -DBOOST_CB_DISABLE_DEBUG or -DNDEBUG. I believe this will help.
Regards,
Jan
________________________________
From: CuneytTaskiran

Worked like a charm! Thanks a lot Jan.
C
On Thu, Feb 25, 2010 at 2:54 AM, Jan Gaspar
Hi Cuneyt,
the circular buffer should be compatible with Interprocess - the only 'problem' is that the circular buffer's debug support relies on 'raw' pointers. Try compiling with -DBOOST_CB_DISABLE_DEBUG or -DNDEBUG. I believe this will help.
Regards,
Jan
------------------------------ *From:* Cuneyt Taskiran
*To:* boost-users@lists.boost.org *Sent:* Thu, 25 February, 2010 5:50:27 *Subject:* [Boost-users] Problem creating a circular buffer in shared memory using Boost Hi,
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 documentationhttp://www.boost.org/doc/libs/1_42_0/doc/html/interprocess/quick_guide.html#...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
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Cuneyt Taskiran
-
Jan Gaspar