Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IDL and COM+

Status
Not open for further replies.

Suppandi

Programmer
Jul 17, 2001
15
US
Hi,

I need to transfer a class from my COM client to my COM server.

MIDL does not recognize classes, hence the following IDL code is incorrect (MIDL says "undefined symbol : class") :

// component.idl
import "unknwn.idl";

class Arithemetic
{
public:
void Multiply(int x, int y);
void Add(int x, int y);
int DisplayResult();
private:
int result;
};


[object, uuid(10000001-0000-0000-0000-000000000001) ]
interface IArithemetic : IUnknown
{
HRESULT TransmitClass([in] class Arithemetic);
};



However, the same code works when I try to transfer a structure (MIDL recognizes "struct").

It should be possible to transfer objects between a COM client and server; I need to know how I can ask the MIDL compiler to generate the proxy, client stubs for this (I'm under the impression that writing the stubs myself would be too difficult).

Any suggestions?

TYIA,
Santhosh
 
Hi,

I put in some time studying 'Marshalling of an Interface pointer' from the book 'Inside COM+ by Eddon and Eddon'.

This is what I have understood:
Marshalling an interface pointer involves re-creating the interface's v-table in the clients address space.
The v-table is fabricated by loading a proxy object (typically a DLL) into the client's process. This proxy exposes the same interfaces as exposed by the real object. The proxy communicates with the object running in the component process.

As per this model, the implementation remains with the component (I need to move the implementation (an object) to the client).

I continued to read 'Custom marshalling of an interface pointer':
IMarshal is designed to marshal interface pointers only. Once the interface pointer is available on the client side, all the work of packing function parameters, sending them to the client/component, and unpacking them is left to he programmer. This can be done through socket programming.

I now see a possible means of moving my object:
Create a custom marshalling interface. Pack and send my object as a parameter to a function call on the remote client.
Am I correct? Is this what you meant?



Marshalling seems to be complex, is there an easier alternative? My present references are 'Inside COM+ by Eddon and Eddon' and 'COM+ Programming by Pradeep Tapadia', do you know of a better resource?

Thank you,
Santhosh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top