Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9464 closed Bugs (wontfix)

Interprocess shared memory support on string between 32bit and 64bit

Reported by: aikhong@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.55.0 Severity: Showstopper
Keywords: Interprocess 32bit 64bit Cc:

Description

I intend to share strings between 32bit and 64bit application. I'm using a vector to store object of structures which contains multiple strings.

It seem to work fine between 32bit and 64bit application if the number of objects stored in the vector is small < 5 objects and the string is short. But it will have problem if the vector is large and the string is long. The memory seem corrupted.

I'm using VC++ 2010 and boost 1.55.

Attached is the sample code.

Attachments (1)

vector.cpp (5.1 KB) - added by elvin 5 years ago.
interprocess 32bit 64bit

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by elvin

Attachment: vector.cpp added

interprocess 32bit 64bit

comment:1 Changed 5 years ago by anonymous

Severity: ProblemShowstopper

comment:2 Changed 5 years ago by anonymous

I'm using boost::interprocess::managed_shared_memory for sharing data between 32bit and 64bit. The full implementation is in the file vector.cpp.

comment:3 Changed 5 years ago by Ion Gaztañaga

Resolution: wontfix
Status: newclosed

What you are trying to achieve is simply not possible. To share classes between processes, the ABI of the compiler must be exactly the same, just when dumping structures or classes to files. Compiling vector or string in 32 bit or 64 bit mode changes radically the ABI (class sizes, integers widths, pointers...).

comment:4 in reply to:  3 Changed 5 years ago by anonymous

Replying to igaztanaga:

What you are trying to achieve is simply not possible. To share classes between processes, the ABI of the compiler must be exactly the same, just when dumping structures or classes to files. Compiling vector or string in 32 bit or 64 bit mode changes radically the ABI (class sizes, integers widths, pointers...).

Based on the Ticket #5230, it seem that boost now support sharing of data between 32bit and 64bit processes. What data type exactly it can share now? just integer? Are you saying that we can't share string between 32bit and 64bit application? Can you elaborate more about this...

comment:5 Changed 5 years ago by Ion Gaztañaga

Ticket #5230 allows managed_shared_memory and other basic classes to be shared between processes, but only in some Operating Systems (e.g. in Linux glibc's mutexes and condition variables can't be shared between 32 and 64 bit processes. After this, anything constructed in shared memory must have exactly the same ABI to be accessible between processes.

comment:6 in reply to:  5 Changed 5 years ago by anonymous

I managed to get it to work by using fix char array e.g char m_strKeyword[250] instead of using wstring. But when I change the container to map instead of vector, it crashes again. Any idea why? Can we actually use boost::interprocess::map to share data between 32bit and 64bit application?

comment:7 Changed 5 years ago by Ion Gaztañaga

You can't use any Interprocess classes as their layout is compiler and and 32/64bit dependant. Unless you are an expert on ABI issues, I don't think you should continue this route, as there will be problems that no one has solved before.

Note: See TracTickets for help on using tickets.