Client Threads and COM objects

Hi all,

I have the following:


- Application Server Service for a Remote DataModule developed in Delphi
- DCOM layer
- Windows NT 4.0 SP3


- Standard n-tier Delphi 3.02 application
- Datamodule with a TRemoteServer + TClientDatasets accessing my Application
- DCOM layer

Everything is working fine, but now in order to improve application
performance we're converting a couple of batch processes into Threads. The
ClientDatamodule - called DtmSIC - is created by Main Application Thread (at
project source).

How to make the DtmSIC instance, created in Application, visible for my
threads ? I want to use ClientDatasets contained in this datamodule inside
my threads.

I saw at Binh Ly's article that to allow access to COM need to marshall
these objects or I'll get the error "The application called and interface
that was marshalled for a different thread".

Here is where I miss the point. I'll need to marshall every IProvider object
contained in this Datamodule or there's a way to marshal the entire
Datamodule ?

When I do the following I fall in an exception.

procedure ThreadSICInterface.RDMAccess;
       DtmSic.CdsProcNome.Close; << Error does here >>

procedure ThreadSICInterface.Execute;


Thanks in advance.

Gustavo Hurtado