Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Wed, 13 Jun 2001 17:06:44 +0200 From: Corinna Vinschen To: cygwin Subject: Re: Issue calling Com function(s) Message-ID: <20010613170644.O1144@cygbert.vinschen.de> Mail-Followup-To: cygwin References: <20010613105216 DOT C1144 AT cygbert DOT vinschen DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from pkg@gleske.org on Wed, Jun 13, 2001 at 10:14:14AM -0400 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:: `-fvtable-thunks=THUNKS-VERSION' 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 function? Another workaround which doesn't need the vtable-thunk stuff is, to use the plain C interface to COM. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin AT cygwin DOT com Red Hat, Inc. -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple