Results 1 to 2 of 2

Thread: Could not initialize OLE weirdness

  1. #1
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Could not initialize OLE weirdness

    Hi,

    I'm a little perplexed about an OLE issue that's arising in some code.
    I've written a C# class library to access a WCF service hosted on some public server. I went with the C# option for pure simplicity in accessing the interface (In Managed C++ it's all very manual and tedious to get things going). This is really just a proxy for a Qt front end. To allow the Qt application to access this WCF client .NET dll, I created Managed C++ library in a separate project which References the WCF client assembly and builds down to a static .lib file. This Managed C++ code is a layer for passing calls to the C# assembly and marshal the .NET serialized classes to a standard char* which is passed back to the client .exe.

    I created a plain C++ console application linking the .lib and all the calls work fine and return valid data as expected.
    When I create a Qt GUI Application simply linking the .lib as per the plain console app, it too runs as expected and returns the same data requested, but on the call to the remote WCF Service Method Qt is dumping the following error to the output console:
    Qt: Could not initialize OLE (error 80010106).

    I don't really understand why Qt itself would be reporting an OLE error. OLE as far as I'm aware usually relates to COM and ActiveQt is not being used here at all, there's just plain linking and the .NET runtime is handling all interaction on the WCF connection (this error appears when stepping over the WCF call in the c# assembly). I'm assuming there's some CCW or RCW going on for the translation in the Managed C++ lib between .NET, but that's within the external lib and Qt shouldn't care.

    If I call the Managed C++ level directly without Qt (entry via a standard C++ class), then it's fine, but as soon as the calling code is pushed into a Qt class called WSTester driven by ...
    QApplication a(argc, argv);
    WSTester w;
    w.show();
    return a.exec();
    ... then it shows the error.

    The only thing that comes to mind is maybe the Visual Studio /clr compiler flag in the Qt GUI project is triggering some odd behaviour? I can't eliminate this though as the linking stage fails due to namespace System (.net namespace) not being resolved.

    Again, I can step all the way into each dll up to the WCF call all the way through without any actual exceptions causing issues and halting execution, but this OLE error does get displayed which I'd like to understand and eliminate if possible.

    Anyone have any ideas?



    Regards,

    Steve York

  2. #2
    Join Date
    Jan 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Could not initialize OLE weirdness

    I faced same problem.

    What's more worrisome is "Qt: Could not initialize OLE: warning can lead to other issues. Copying to clipboard fails after this warnings, giving error:
    "QClipboard::setMimeData: Failed to set data on clipboard".

    Workaround is to make the managed code library as dll instead of lib. As long as your qt application does not see the managed code at link time, it is OK.

    Regards,

    Pankaj

Similar Threads

  1. Replies: 2
    Last Post: 3rd March 2012, 05:57
  2. QString::append() weirdness
    By mattc in forum Qt Programming
    Replies: 16
    Last Post: 17th October 2010, 14:02
  3. [SOLVED] quint16 weirdness
    By pdoria in forum Qt Programming
    Replies: 4
    Last Post: 15th October 2009, 01:09
  4. Memory leak weirdness
    By Darhuuk in forum General Programming
    Replies: 10
    Last Post: 10th January 2008, 19:51
  5. QSplashScreen Weirdness
    By mclark in forum Qt Programming
    Replies: 11
    Last Post: 19th November 2007, 07:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.