[Mono-list] COM / DCOM in Mono

Paolo Molaro lupus@ximian.com
Wed, 5 Mar 2003 12:01:23 +0100

On 03/05/03 Eran Sandler wrote:
> Well, I'm currently investigating how implement DCOM on other systems. I
> know it WAS implemented for UN*X and Linux by 3rd party companies but
> they didn't release the code.
> Working with DCOM shouldn't be that hard since I only need a proxy alive
> and a way to marshal data to it (at first it can be other proxies or
> simple data types.
> It might give us what we want.

If I may suggest a course of action:
* start small, get the simple things working first
* that pretty much means starting the work on a windows system so
that you can use the standard COM libraries there and you can focus on
the mono side of the development
* create a simple void Ping() client or server (whichever is easier to
implement) and then figure out what kind of support is needed in the
runtime to either expose the server or call out to the client.

Creating a little tarball with the code and a makefile to compile it
with the ms runtime will be helpful as a start, to see what kind of
support is needed (and how the metadata looks like for the COM cliet or

> Although I have a question. 
> I will try to implement DCOM in C or C++ (I haven't decided yet), I
> persume I need to use some form of Platform Invoke to call this code,
> right?
> Can you point me out to a place where P/Invoke was used so I can check
> it out a bit?

Look into metadata/marshal.c, the mono_marshal_get_native_wrapper ()
function. Basically, when the JIT sees a call to a P/Invoke method m,
it calls:
	wrapper_method = mono_marshal_get_native_wrapper (m);

and wrapper method is called instead. The wrapper takes acre of the
need for marshaling values or different call conventions and so on.
I guess COM requires similar support.


lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better