Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • 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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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