I'm trying to integrate a 3rd party C++ DLL with a C# application. The 3rd party documentation says:
"The application must have a Windows Message loop in order to the use the API. It is through the message loop that the TCP messages are sent..."
My entry into the C# application is through a plugin framework, so it significantly more complicated that your average WinForms app however, I'm not sure I understand the mapping between MFC message loops and the loops issued by Threading.Dispatcher as recommended here and here
If C# obfuscates this completely, I suppose I could run a message loop in my CLI layer and poll for messages from the C# plugin.
I'm not even positive this is the issue; however my CLI layer works in a simple WinForms test application, but does not seem to catch callbacks with in the plugin ecosystem.
Thanks S.O Community!
UPDATE: Hmm, after looking more closely into the two links included above. I'm not actually confident they are germane.
Adding
Application.Run();
to my thread running the CLI layer does indeed pump the callbacks. But then it crashes, or throws an Access Violation (that my generic catch( Exception) never catches..). Frustratingly, this is the same error I get but the comments just acknowledge that this happens.
I don't have access to the form to get a handle or an application context. Most of answers I've found are for COM interfaces which this is not(i did try adding the STAThread attribute anyway, but to no avail.
Is there another call that will pump the Windows message loop once so I can put it in my own loop?