LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically relink Call Library Function Node to XYZ.dll file when XYZ.dll file replaced with newer version (same functions inside)

Solved!
Go to solution

I have a main VI that calls a bunch of functions inside a dll (call it "XYZ.dll").  Everytime I make modifications to XYZ.dll and replace the old XYZ.dll with the new file of the same name with the exact same function calls inside, all my Call Library Function Node calls in the main LabView VI get broken.  I then have to manually re-link each Call Library Function Node to the new XYZ.dll library.  Is there a way to re-link the calls programmatically?

0 Kudos
Message 1 of 9
(4,960 Views)

Are you able to specify the dll's path on the block diagram and does it get around this problem?

Matt J | National Instruments | CLA
0 Kudos
Message 3 of 9
(4,944 Views)

Hi cbutcher,

This definitely looks promising, however I'm not sure exactly how to apply it to my VI.  I changed the paths in the code snippet, closed the VI to be updated, ran the script, reopened the VI to be updated, and saw that there was no change to the CLFN dll path...

0 Kudos
Message 4 of 9
(4,925 Views)

@Jacobson, thank you for the suggestion.  I'm not sure how to specify the dll's path outside of setting it in the CLFN.  Is there a control for the CLFN dll filepath somewhere?

0 Kudos
Message 5 of 9
(4,924 Views)

I just set CLFN to "Specify path on diagram" and wire the path in as a constant.

0 Kudos
Message 6 of 9
(4,916 Views)

Ahh thanks, I see that option now.  I may have to do that, although I'm hesitant to add an additional filepath wire to 20+ CLFN calls on an already overcrowded block diagram...

0 Kudos
Message 7 of 9
(4,912 Views)
Solution
Accepted by topic author Chris_P_SD

@Chris_P_SD wrote:

Hi cbutcher,

This definitely looks promising, however I'm not sure exactly how to apply it to my VI.  I changed the paths in the code snippet, closed the VI to be updated, ran the script, reopened the VI to be updated, and saw that there was no change to the CLFN dll path...


Ah. I think when I tested it maybe the VI was open. You probably need to add a Save VI invoke node at the end using the VI reference. Sorry I didn't catch this!


GCentral
0 Kudos
Message 8 of 9
(4,887 Views)

Thanks Cbutcher, as you suggested, the working code looks like this:

 

DLLSwapper BD 170628_A.PNG

 

Just to summarize, this mini VI finds all instances of the CLFN (Call Library Function Node) in the target VI, where the target VI is defined in the filepath constant at left-most edge of the block diagram.  It then replaces all these instances of the CLFN with the new DLL defined in the bottom filepath constant.  This is useful for updating large block diagrams with many CLFN calls that aren't wired to a single filepath constant.

 

 

Thanks everyone.

 

Chris

Message 9 of 9
(4,844 Views)