I'm currently in the process of moving some code from native C++ to managed C++ (pure). The code involves interacting with Windows Active Scripting. Currently our native code provides a class called 'ObjectDispatch' which implements 'IDispatch' (using ATL). This class implementation queries our own native class 'Object' at runtime to determine what methods and properties it supports and then forwards any 'IDispatch::Invoke' calls to this 'Object'.
I have seen examples using .NET COM interop which support 'IDispatch', however those implementations where either derived from IDL or where based on the specification of a .NET class, neither of which occurs at runtime.
It appears that .NET COM interop can generate a implementation of 'IDispatch' at compile time if you use the following attribute on a given class:
[ClassInterface(ClassInterfaceType::AutoDispatch)]
I'm assuming that I could dynamically generate a class at runtime that supports this attribute. However before I attempt that I'm wondering if anyone has any ideas how this might be achieved through similar means that were used with the native code.
Note that at this time the 'Object' class is remaining as a native class.