public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* g++ COM problem with function pointers and -O2
@ 2000-05-08  6:48 Fifer, Eric
  0 siblings, 0 replies; 2+ messages in thread
From: Fifer, Eric @ 2000-05-08  6:48 UTC (permalink / raw)
  To: cygwin

I'm use Cygwin, Perl and the Win32::OLE Perl module to interact with
COM objects.  And, of course, the Win32::OLE DLL is compiled with
-fvtable-thunks.  For the most part everything works just fine
(and as of Cygwin 1.1.0, Perl 5.6.0 and Win32::OLE 0.12 build
right out the box).

However, the extra DCOM functions like CoCreateInstanceEx are
implemented in the Win32::OLE Perl module by dynamically looking up
functions, LoadLibrary("OLE32") GetProcAddress("CoCreateInstanceEx"),
and calling through the function pointers.  However, this fails
when Perl is compiled with -O2 or -O.  Note that the Win32::OLE module
is dynamically loaded into Perl and the problem is triggered
when the separate Perl DLL has been built with the optimizer.

There are a couple of work-arounds.  Things are fine if Perl
is built with just -g!  Also, If I change the function pointer
to just a normal function call, it works too.  The failure with
function pointers and -O2 manifests itself as a stack corruption.

I know there are some limitations with COM support, but this
seems particularly strange because it depends on whether the
optimizer is used by a separate DLL.

Any idea what's going on here?

Thanks,

Eric Fifer

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: g++ COM problem with function pointers and -O2
@ 2000-05-10  3:52 Fifer, Eric
  0 siblings, 0 replies; 2+ messages in thread
From: Fifer, Eric @ 2000-05-10  3:52 UTC (permalink / raw)
  To: cygwin; +Cc: 'Mumit Khan'

After seeing the description of the C++ parser bug with function
attributes under the "g++/linker bug on cygwin1.1.0 (win32)"
thread, I went back to look at the code causing my problem.

I switched some declarations around, from:

  typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
    (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);

  FNCOCREATEINSTANCEEX *pfnCoCreateInstanceEx;

to:

  HRESULT STDAPICALLTYPE (*pfnCoCreateInstanceEx)(REFCLSID,
	IUnknown*, DWORD,COSERVERINFO*, DWORD, MULTI_QI*);

And this also works around my problem.

Could this be another manifestation of the same bug?

Thanks,

Eric Fifer



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-05-10  3:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-08  6:48 g++ COM problem with function pointers and -O2 Fifer, Eric
2000-05-10  3:52 Fifer, Eric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).