Jump to content

Dynamically launch VI can't pass DVR to caller


Recommended Posts

If I create a DVR in a dynamically launched VI, the DVR ref goes stale when it's passed back to the caller. Anybody know why? See the attached code (LV15) for an example.

I don't want to use the ACBR node right now because I want to set some control values of the VI ref on a different diagram than the one that will run it. (I just want to pass the VI ref between calling diagrams, not all the values that'll be passed into it.)

DVRtest.zip

Link to comment
26 minutes ago, Stobber said:

If I create a DVR in a dynamically launched VI, the DVR ref goes stale when it's passed back to the caller. Anybody know why?

References are “owned” by the "VI hierarchy" that created them, and are automatically destroyed if that hierarchy goes idle.  Asynchronously-called VIs run in their own independent hierarchy (even if you use the Run method instead of ACBR).  In your example, the DVR was destroyed when the launched VI finished.  

Link to comment
31 minutes ago, Stobber said:

If I create a DVR in a dynamically launched VI, the DVR ref goes stale when it's passed back to the caller. Anybody know why?

The DVR will remain valid for as long as your dynamically launched VI is running (or rather for as long as the VI which created the DVR stays in memory). Since you wait for it to finish execution LabVIEW recognizes the VI as being idle and therefore removes any remaining references automatically. Reading the indicator value as variant doesn't help either, as LabVIEW cannot recognize the value as reference type.

You can try an FGV to store the DVR in a buffer (the FGV must create the DVR though), but this will work for one instance only.

Another option is to create the DVR in the caller and pass it to the dynamically launched VI. That's assuming the caller knows the DVR type => maybe use a subVI to create the DVR in the caller and pass it to the dynamically launched VI.

Link to comment
  • 4 weeks later...
  • 1 month later...

Norm,

let's assume I have two VIs that are running in parallel and sharing an ESF based session. VI 1 started earlier so it created the session whereas VI 2 found the active reference. Excellent.

The question now is what should happen when I stop VI 1 and it closes the reference with 'force destroy' flag set to FALSE. Should my session reference in VI 2 still be valid? Since the 'owner' is not running anymore I guess it shouldn't and this is also what I'm experiencing. Can you confirm it? If yes, I would like to know more about the version of ESF you mentioned.

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.