LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

call by reference node - passing a reference of a cluster or references

Hi,
 
Im trying to write a server application that can dynamically load a plug in driver vi depending on some connected hardware.  As the method of connection of the hardware changes - sometimes it will be serial, sometimes TCP/IP - and i want the form of the driver VIs to be standard i need the connectors to be identical as I'm calling the VIs by reference node.  However sometimes I need to pass a TCP/IP ref num and sometines a serial ref or otherwise.
 
I have tried to pass a reference to a cluster which contains whatever I need but I just get errors.  I can't just keep the refnums in the VIs as I need the app to be reentrant.
 
In summary i would like to just pass the VIs that I call be reference node a refnum for a structure that contains any refnums they need.  Is this posible?
 
At present I just get an "LabVIEW:  Object reference is invalid." whne I try to recover the refnums. 
 
Attached are some screen grabs of some code.
 
1) Where the reference to the cluster is generated.[creatingClusterAndRef.gif]
2) the top level VI (the FTR INIT vi dynamically calls the VI that generates the refnum to cluster)[topLevel.gif]
3) The VI that is called dynamically where the refnums are recovered.[dynamicallyCalledVI.gif]
 
Any help appreciated.
Peter
0 Kudos
Message 1 of 3
(2,808 Views)

Hi Peter,

With a little more view to the left in "CreatingClu..." and a clue as to which node is flagging the error I would not have to guess.

I suspect the issue is that you are attempting to us a reference opened on the server side and use it on the client side. I believe you may get away with this if both the server adn client were the same machine but not across the network.

Sorry if I am guessing wrong.

If not please post larger iamges of the entire refnum data path start to end.

Trying to help,

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 3
(2,792 Views)

Hi Peter,

      I liked your idea - having faced exactly the same situation, it never occured to me to do this.  I built a simple example of one VI calling another as you've shown.

In my example, IF the caller terminates after invoking the callee, the reference [in the callee] is bad as soon as it can be checked, however, if I put a loop in the caller (to keep caller running,) the TCP reference is valid when the callee checks it.  So your idea seems to work (for me, and assuming callee is on local machine.)

Thanks for the post! 

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 3 of 3
(2,777 Views)