OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Jonas Blunck TACMa (jobuTAC.SE)
Date: Mon Dec 03 2001 - 12:28:34 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    You should without doubt call CoInitialize for each thread. COM can be
    forgiving in these situations since you probably have your hands on an
    inproc raw interface pointer. If you instead had a proxy to an object, the
    behaviour would be different (RPC_E_WRONGTHREAD or something like that).

    After all, since there is no proxy between the object and your apartment,
    the COM runtime cannot do anything to check the semantics of your calls.

    What puzzles me is that CoMarshal/Unmarshal interface seems to succeed. I
    would like to know why, so if you figure it out; please let us know :-)

    // B

    -----Ursprungligt meddelande-----
    Från: Vagish Kalligudd [mailto:vagish.kalliguddCELSTREAM.COM]
    Skickat: den 3 december 2001 17:15
    Till: DCOMDISCUSS.MICROSOFT.COM
    Ämne: ADO Connection

    Win NT 4 SP 6
    I am using ADO using #import ... msado15.dll in a Win32 console application.
    In the 'main' application thread I enter a STA by calling CoInitialize(NULL)
    and then create a global connection object. From the main thread I spawn a
    number of threads. Each of these threads do not call CoInitialize. In each
    of these threads I Open a recordset with a SQL query string using the global
    connection object. After scrolling thru the records I close the recordset in
    the same thread. I am using the unmarshalled Connection object in the
    secondary threads. I do not have a message loop in the main thread.
              As far as I my COM knowledge goes an interface pointer should be
    marshalled between threads using CoMarshalInterface...etc
    But how is this working? Even if I use CoInitialize .. CoUninitialize in the
    secondary threads I see no difference.

    Thanks,
    Vagish

    ----------------------------------------------------------------
    Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    contains important info. Save time, search the archives at
    http://discuss.microsoft.com/archives/index.html .
    To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM

    ----------------------------------------------------------------
    Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    contains important info. Save time, search the archives at
    http://discuss.microsoft.com/archives/index.html .
    To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM