Client Threads and COM objects

Hi all,

I have the following:

[Server]

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

[Client]

- Standard n-tier Delphi 3.02 application
- Datamodule with a TRemoteServer + TClientDatasets accessing my Application
Server
- 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;
begin
       DtmSic.CdsProcNome.Close; << Error does here >>
       DtmSic.CdsProcNome.Provider.SetParams(EdtName.Text);
       DtmSic.CdsProcNome.Open;
end;

procedure ThreadSICInterface.Execute;
begin
     CoInitializeEx(NIL, COINIT_APARTMENTTHREADED);
     ...
     Synchronize(RDMAccess);
     ...
end;

end;

Thanks in advance.

Gustavo Hurtado