Jump to content

Callbacks without a single line of text code


Recommended Posts

21 hours ago, dadreamer said:

no good TL;DR was invented. You

Did ChatGPT make a passable TL;DR?

Quote

The author of the article discusses their exploration into creating callbacks in LabVIEW using .NET delegates. They explain that they initially wanted to create a .NET event at runtime but found it to be impossible. They then investigated the LV native Register Event Callback node but ran into some challenges. They eventually discovered a middle layer generated by LabVIEW that converts native calls to VI calls using the NationalInstruments.LabVIEW###.dll assembly. They were able to use this assembly to call a delegate and successfully invoke a callback VI. They provide an example of how to do this and note that while it is possible, it involves several hacks and may not be suitable for real-life applications. They conclude that this information may be useful as a reference for future development ideas.

 

  • Like 1
Link to comment
  • 2 weeks later...

For completeness, on Windows it's also possible to execute a VI as a callback function like this:

  1. Write a VI with the needed callback signature and a mechanism to pass the data you want onward.
  2. Compile it into a DLL.
  3. Load it from the DLL using GetProcAddress and pass that as the callback pointer.

I posted an example here, which I believe also uses EnumWindows.

 

This comes with its own bunch of caveats, and I never actually used it beyond playing with it, but it is simpler and doesn't require text based code either.

Link to comment

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.