Issue calling Com function(s)

Corinna Vinschen
Wed Jun 13 08:06:00 GMT 2001

On Wed, Jun 13, 2001 at 10:14:14AM -0400, Paul K Gleske wrote:
> Nice try but, there is nothing there about either flag (-fvtable-thunks
> or -fnative-struct) in the info gcc supplied with cygwin.

On Cygwin:

info gcc,  * Invoking GCC::,  * C++ Dialect Options::

     Use `thunks' to implement the virtual function dispatch table
     (`vtable').  The traditional (cfront-style) approach to
     implementing vtables was to store a pointer to the function and two
     offsets for adjusting the `this' pointer at the call site.  Newer
     implementations store a single pointer to a `thunk' function which
     does any necessary adjustment and then calls the target function.

     The original implementation of thunks (version 1) had a bug
     regarding virtual base classes; this bug is fixed with version 2
     of the thunks implementation. With setting the version to 2,
     compatibility to the version 1 thunks is provided, at the cost of
     extra machine code. Version 3 does not include this compatibility.

     This option also enables a heuristic for controlling emission of
     vtables; if a class has any non-inline virtual functions, the
     vtable will be emitted in the translation unit containing the
     first one of those.

     Like all options that change the ABI, all C++ code, _including
     libgcc.a_ must be built with the same setting of this option. Since
     version 1 and version 2 are also incompatible (for classes with
     virtual bases defining virtual functions), all code must also be
     compiled with the same version.

     In this version of gcc, there are no targets for which version 2
     thunks are the default.  On all targets, not giving the option
     will use the traditional implementation, and -fvtable-thunks will
     produce version 2 thunks.

> I notice that the compiled code is different when using those flags.  In
> fact the code looks like is more "right" than without the code, but
> nonetheless I still get a segv when calling the ImageStream->Stat method.
> It appears that the call itself is failing (the call through edi), so it
> appears that the vtable is not being handled right.

Did you actually call `CoInitialize(NULL)' before calling the

Another workaround which doesn't need the vtable-thunk stuff is,
to use the plain C interface to COM.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                      
Red Hat, Inc.

Want to unsubscribe from this list?
Check out:

More information about the Cygwin mailing list