Compatibility with g++ and VS

Hi,

We're not calling the Clang command line program, but rather hooking into parts of it to JIT compile some code. We'd like to pass data structures back and forth between the Clang compiled code and the ahead-of-time compiled code, which uses g++ on Linux and VS on Windows.

So my question is: are classes laid out exactly the same in memory? If I give the same source to g++/VS and Clang, will the objects have the same fields in the same order with the same padding, same virtual function table, etc. ?

Thanks,
Martin

Hi,

We're not calling the Clang command line program, but rather hooking
into parts of it to JIT compile some code. We'd like to pass data
structures back and forth between the Clang compiled code and the
ahead-of-time compiled code, which uses g++ on Linux and VS on Windows.

So my question is: are classes laid out exactly the same in memory? If
I give the same source to g++/VS and Clang, will the objects have the
same fields in the same order with the same padding, same virtual
function table, etc. ?

For g++, yes. For VC, we will probably get the same layout for C structs and POD classes, but we don't implement Microsoft's C++ ABI.