I'm assuming here that you're using "stub" in the Java sense, to mean
the thing on the client side that looks like the object.  (Microsoft
have always used "stub" to mean the other end.  They use the term
"proxy" for the client-side part.  But the only way I can make sense of
your post is if you mean the client-side part when you say "stub".)

If what you want to do is control the signature of the methods
available, then you don't need to write your own TP.  All you need to do
is build a transparent proxy for a type which supplies the signatures
you require.

If you already have an appropriate interface definition or class
definition defining the method signatures you require, then you're done.
But if you would like to generate method signatures at runtime, you
should be able to generate the interface definitions using
Reflection.Emit, and then pass the resulting generated type in when you
build the Transparent Proxy.

So you really don't need to be able to generate the TP yourself to
achieve what you're trying to achieve.  (Which is a good thing - you
wouldn't be able to do so reliably anyway, because there's no guarantee
that the calling convention used by the CLR won't change from one
version of .NET to the next.  Using this approach insulates you from
such changes, and also means it should work on the Itanium version of
.NET, whenever that appears.)


But if you really do mean stub in the Microsoft sense (i.e. the bit on
the server side), you can replace absolutely anything downstream of the
transparent proxy, and you don't need assembly language to do it. 

-- 
Ian Griffiths
DevelopMentor

> -----Original Message-----
> From: Ramkishore [mailto:[EMAIL PROTECTED]
> 
> Hi,
> 
> Does anyone know how to write a custom stub for the TransparentProxy/
> RealProxy. RealProxy constructor does take in a stub of type IntPtr. I
> would like to know if there is any way to control the method signature
> invoked by TransparentProxy. My understanding after reading Chris
Brumme's
> blog http://blogs.gotdotnet.com/cbrumme/  on TransparentProxy is that
the
> stub is a machine code.(ie. x86  code for windows). If so, I guess
there
> is no portable way to provide our own stub implementation, right?

Reply via email to