|
Boost Users : |
Subject: Re: [Boost-users] shared memory between 32b and 64b
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2013-01-16 15:10:06
El 16/01/2013 1:33, Dave Dyer escribió:
>
> Looked promising, but not quite good enough. I dedined:
>
>
> typedefoffset_ptr<class T, std::ptrdiff_t, unsigned long long
> >my_offset_ptr;
> typedef basic_managed_shared_memory
> <char
> ,rbtree_best_fit<mutex_family, my_offset_ptr>
> ,iset_index>
> compat32_shared_memory;
>
>
> in the win64 process I do
>
> compat32_shared_memory segment(create_only, SEGMENT_NAME, SEGMENT_SIZE);
> comm *command = segment.construct<comm>( "CommandBlock" )();
>
> in the win32 process in do
>
> compat32_shared_memory segment(open_only, SEGMENT_NAME);
> std::pair<comm *,size_t>com = segment.find<comm>("CommandBlock");
>
> the "find" never returns.
>
> The code works fine if both processes are win32 or both are win64
> Am I on the right track?
Sorry about my previous reply. I just noticed that the definition for
my_offset_ptr must be binary compatible in 32 and 64 bit processes so
std::ptrdiff_t should not be used (as it's 32 bit in 32 processes and 64
bit in 64 bit processes).
Try with something like:
typedef offset_ptr< void , boost::int32_t , boost::uint64_t >
my_void_offset_ptr;
or
typedef offset_ptr< void , boost::int64_t , boost::uint64_t >
my_void_offset_ptr;
Good luck!
Ion
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net