Hi,
Yet another problem of different behavior exhibited when building on
Win2k and XP.
Using AMD64 environment (Windows 2003 SDK SP1-April2005 edition - /XP64
/RETAIL options set) and VS2003 IDE to compile a file.
This cpp file is importing a typelibrary like this:
#import "COMLib.tlb"
//.... code
//.... code
When I compile this file in Win2k and generate preprocessor output (/P
option), I see that for an interface definition, two extra methods are
being added (_VtblGapPlaceHolder1( ) and 2..)
struct __declspec(uuid("4730c519-8998-43f6-993b-80befea1d404"))
ITCSpecific : IUnknown
{
HRESULT GetUserKey(/* removed params */ );
HRESULT ReleaseSpace ( );
HRESULT WriteValue (/*removed params*/ );
virtual HRESULT _VtblGapPlaceholder1( ) { return
((HRESULT)0x80004001L); }
virtual HRESULT _VtblGapPlaceholder2( ) { return
((HRESULT)0x80004001L); }
virtual HRESULT __stdcall raw_GetUserKey ( /*deleted other
params*/ ) = 0;
virtual HRESULT __stdcall raw_ReleaseSpace ( ) = 0;
virtual HRESULT __stdcall raw_WriteValue (/*deleted params*/ ) =
0;
};
Under same conditions on Win XP SP2 however, the preprocessor output
does not have these PlaceHolder methods. And my server dll was built on
XP SP2.

so when I build client on Win2K, method invocation is messing up due
to extra 16 bytes added to vtbl offset because of PlaceHoler()
methods. and so instead of invoking GetUserKey(), WriteValue() gets
invoked.
WHY, WHY!! Why is the compiler behaving differently on Win2k and Win XP
SP2. What brings in _vtblGapPlaceHolder1() methods??? I can't ship my
SDK code until it is buildable from Win2K and XP SP2 targeted to 64-bit
environment.

(
ved