Compatibility with g++ and VS

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Compatibility with g++ and VS

Martin C. Martin-2
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
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Compatibility with g++ and VS

Douglas Gregor


Sent from my iPhone

On Jul 13, 2010, at 3:59 AM, "Martin C. Martin" <[hidden email]> wrote:

> 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.


> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev