|
-
May 13th, 2009, 02:03 AM
#1
Creating in-proc COM Objects in the right apartment
If a client wants to create an in-proc server COM object marked as FreeThreaded in the registry, does the client need to create this object on an MTA thread? What happens if it creates the object in an STA thread - is the object still created in the MTA and the interface pointer marshalled, or is the object created in the calling thread ie. STA?
I have read 2 different contradicting things about this scenario. One scenario says that the calling thread is in charge of the apartment it wants to create the in-proc COM object in - the object is created in the calling thread's apartment. However, another source says that the in-proc object is always created in the apartment indicated in the registry and the interface pointer marshalled between interfaces.
Can anyone clarify this for me?
-
May 13th, 2009, 02:07 AM
#2
Re: Creating in-proc COM Objects in the right apartment
I don't remember, but you can put a TRACE statement with the threadID in it and test for it yourself.
-
May 13th, 2009, 07:54 AM
#3
Re: Creating in-proc COM Objects in the right apartment
As you long as you check the Free threaded marshaller box the generated code should make sure your object marshalls correctly.
-
May 14th, 2009, 12:34 AM
#4
Re: Creating in-proc COM Objects in the right apartment
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|