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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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