Boost logo

Boost Users :

From: Da Xu (djsignal7_at_[hidden])
Date: 2020-03-03 01:43:31


 Thank you for the reply. 
Right now, I am actually stuck in Boost's segment manager. Its own data structure got scrambled in the memory. I haven't even gotten to where my own data structure gets read.
If I do go with the bare metal approach,  I will definitely keep these advice in mind.

Da.
    On Monday, March 2, 2020, 06:33:55 PM EST, Gavin Lambert via Boost-users <boost-users_at_[hidden]> wrote:
 
 On 3/03/2020 08:37, Da Xu wrote:
> Thank you guys. Yah, the problem is that the pieces I am writing are all
> DLLs. And of course, gcc DLL and Msvc DLLs aren't compatible. Therefore,
> I HAVE to use two compilers.
>
> So, clang might produce data structure layout that might be compatible
> with gcc?

If you confine your shared memory interface to POD types that use
well-known-sized fields, then most compilers will produce a compatible
binary layout.  (With a few quirks to watch out for, such as default
padding and potentially different sizes for "int", "long", "size_t",
"time_t", etc.  It doesn't hurt to explicitly static_assert(sizeof(T) ==
known_constant) in both compilers.)

It's when you introduce non-POD C++ types that you typically run into
trouble.  For example, library types such as std::string are not
guaranteed to have equivalent binary layout across different compilers
(or even different compiler versions).
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
  



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