I have a DQMH module where the main public API VI's are exposed in a .NET interop DLL. The dll works fine in a basic C# app I created - the dll has a method to start the module, then I can call my public DQMH request/reply VI's. Even the structs (clusters) for input and output are nicely represented in the compiled dll. I really like how it works, but it's strictly a synchronous paradigm - C# makes a request, labview does something in the DLL, and C# collects the results from the blocking call.
While this works well enough for basic things, and we could make things pseudo-async by wrapping things in tasks and whatnot, but there are certain time when the DQMH module may be doing some work in the background and needs to let c# know that "something happened" . For that, I want to trigger an event in the C# app whenever certain LabVIEW events happen inside my DQMH module.
I don't know if there is a way to do this natively by returning a certain kind of reference from one of the vi's I choose to expose in the .NET interop dll?
Maybe I will have create some instance a .NET object that already has some public events, subscribe to them in c# and then pass that instance into my application as a parameter (i.e. via one of the methods exposed on the .NET interop dll) then use normal .NET calls to fire the event? Is there a cleaner way of doing this without this kind of coupling and careful startup sequencing?