[RFC] msvcp120: Change exported vbtable sizes.

Piotr Caban piotr.caban at gmail.com
Tue Jan 5 05:38:29 CST 2016


Hi,

On 01/04/16 12:08, Bernhard Übelacker wrote:
> The test contains 2 tests:
>   - Simply check the exports of the vbtable sizes for their values.
This test needs some improvements before it can be accepted to wine. The 
structure sizes are different in 32-bit and 64-bit cases.
>   - Call constructor and destructor like it is done in Supertux.
This test will need to be rewritten in order to get into wine. You 
should use vbtable while computing this pointer (you can tests values 
inside vbtable). The test should also be named differently (e.g. 
test_virtual_base_func_call).

> I tried to add these 8 bytes as an unknown field to basic_istream_*
> and basic_ostream_* structs. But then I cannot find a way to get the
> sizes for basic_iostream_* right.
I've tried to find what happens there. It looks like there's a bug in 
Visual Studio that is described here (sorry I couldn't find it on 
Microsoft pages):
http://stackoverflow.com/questions/14487241/avoiding-an-inheritance-by-dominance-warning-for-a-mocked-stdfstream-class

I've tried looking on basic_istream_char class layout (32-bit):
void* vbtable
4-byte padding
int64 count
4-byte padding
int vtordisp = 0 (as described 
https://msdn.microsoft.com/en-us/library/7sf3txa8%28v=vs.100%29.aspx)
basic_ios_char

I've also tried creating following classes and ended with a different 
layout:
class vbase {
public:
     int a;
     virtual ~vbase() {};
};

class c : virtual public vbase {
public:
     int b;
     virtual ~c() {};
     virtual _Add_vtordisp1() {};
};

c class has following layout (as expected):
void *vtable;
void *vbtable;
int b;
void *vtable;
int a;

if b is defined as offsetof the layout changes strangely (looks like 
there's another problem in compiler related to padding):
void *vtable;
4-byte padding;
void *vbtable;
4-byte padding
int64 b
void *vtable
int a

The difference shows that _Add_vtordisp1 and _Add_vtordisp2 are defined 
in basic_ios_char class.

I don't understand yet why vtordisp is needed. It's kind of described 
here 
(https://msdn.microsoft.com/en-us/library/453x4xdd%28v=vs.100%29.aspx) 
but I don't understand it yet.

Thanks,
Piotr



More information about the wine-devel mailing list