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

Re: Help! _VtblGapPlaceHolder1() added during preprocessing by Andre

Andre
Wed Mar 08 23:14:43 CST 2006

Its probably best if you post this issue to:
microsoft.public.vsnet.general
microsoft.public.vsnet.debugging
--
--
Andre
Windows Connect | http://www.windowsconnected.com
Extended64 | http://www.extended64.com
Blog | http://www.extended64.com/blogs/andre
http://spaces.msn.com/members/adacosta

<yezdived@gmail.com> wrote in message
news:1141876306.847518.26100@i39g2000cwa.googlegroups.com...
> 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
>