• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

B-I-G COM -problem

Hi all,

My Project has a big problem - we are using COM Components (ADO, MSXML) in a multithreaded application. As soon as we run the application on a multithreaded processor, it crashes. The MSDN says that we have to do some kind of proxy in order to use the MSXML in a multithreaded app. Can anyone please give me some hints on how to do this? Have anyone used COM in a multithreaded app?

cheers,

henrik
0
henrikatwork
Asked:
henrikatwork
1 Solution
 
RobnCommented:
How are you calling CoInitialize?
Have you tried this...
CoInitializeEx(nil, COINIT_MULTITHREADED);
0
 
bpanaCommented:
listening ...
0
 
andrewjbCommented:
You need to CoInitialize in each thread.

And you can't just pass COM interface pointers between threads - they must be marshalled. Are you doing this?
0
 
henrikatworkAuthor Commented:
nope, how do I do the marshallening? I've never been doing that with Delphi, can you maybe give me an hint?

cheers,

henrik
0
 
andrewjbCommented:
Easiest way is to use CoMarshalInterThreadInterfaceInStream (what a function name!) which you can find documented in msdn, if nowhere else (just google!) Is that enough to get you going? The function is pretty obvious when you read it's description...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Tackle projects and never again get stuck behind a technical roadblock.
Join Now