I am working on a C# 3.5 plugin that is used by an unmanaged C++ host application. This C++ application is a 3rd party commercial application and I don't have the source code to it.
Anyway, I have the plugin working using a managed C++ helper DLL that handles all of the unmanaged to managed API calls. My plugin has a managed UI that is embedded into a native window that is supplied by the unmanaged application. I use NativeWindow to do this.
But now I have run into a problem where I can't get Drag & Drop to work. This has something to do with COM not being initialized or something, and I am looking at ways to solve this.
Anyway, that is not the main reason I'm here. I heard rumors that there could be an easier way to do something like this in C# 4.0. Is this true? Ideally, it would be something like:
[DllExport]
private static void MyMethod(...)
{
...
}
So what happens is that the method is exported so that it becomes visible as a C entry point using the same marshalling features that DllImport gives you. This way I can write my plugin as a single C# DLL that exposes C entry points. Hopefully it will also do proper COM initialization etc.
Does anyone know if something like this is forthcoming in C# 4.0?