Joel Lucsy said:
Why would you need a CCW? The host uses COM to instantiate the CLR and
then uses those interfaces to call whichever managed code you want. To
call back into the host you could use P/Invoke just fine without having a
CCW around. Of course this method means you can't use classes defined in
the host, but this may not be a problem as it really depends on what
you're trying to accomplish. I've tested this technique just fine.
Joel,
I 'm not 100% clear on what you mean here. The host instantiates the CLR
using the COM based hosting API's, that's right, but the CLR is unmanaged
code. And then you say; "then uses those interfaces to call whichever
managed code you want."
If you mean by this that you can use the hosting API's to load an assembly
and START executing this managed ( say C#) code by calling it's entry point,
then I agree, but this is not the same thing as a direct call into managed
objects methods from native code. This is simply not possible has you need a
Object reference in order to call managed methods, or you need a CCW that
translates the .NET object model into a COM interface model so that native
COM clients can create instances and call methods through COM interop, or
you need a wrapper class that thunks the native C++ object into a managed
interface.
Willy.