LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reload Dll

Hello.

 

I created the dll to reuse my old code in LabVIEW and call functions with Call Library Function node. That works fine.

Now I'm adding one new function to the dll, rebuilding it and trying to call this function from LabVIEW. LabVIEW can't find this function.

 

Ok, I'm renaming the dll, replacing the old name with the new one in the Call Library Function node, and now LabVIEW sees my new function.

 

Tried to restart LabVIEW, even it didn't help. How to convince LabVIEW to reload the dll?

0 Kudos
Message 1 of 7
(4,062 Views)

That error can mean a lot of different things.

 

We need to see the entire error cluster.  Not just the error number.

http://www.medicollector.com
0 Kudos
Message 2 of 7
(4,050 Views)

josborne,

 

What error you're talking about? There was no error at all. The Call Library Function node just behaves like the dll never been updated. For example, I had a function Calculate that calculated something and returned the result, e.g. 2. Then I updated the function Calculate and expect it to return 4, but the Call Library Function node still receives 2.

 

Then I rename the dll and replace it's name in the Call Library Function node. Now my function Calculate returns correct result 4. It looks like LabVIEW keeps a copy of my dll somewhere, loads it from that location, and unaware of any updates to the dll in its original location.

0 Kudos
Message 3 of 7
(4,046 Views)

Just to make sure I understood correctly, you're updating the DLL but not restarting LabVIEW? Did you close the VI (and any of its callers) to force that VI out of memory? I feel like I've seen posts about this before, but I don't remember a specific solution. Closing the VI might do it, since the DLL is loaded at the same time as the VI that calls it if the path to the DLL is specified in the call library configuration. If you pass the DLL path to the Call Library node as an input, then the DLL isn't loaded until the Call Library function executes (since the path isn't known until then), but then you don't get the automatic list of functions in the DLL when you configure the call library node.

0 Kudos
Message 4 of 7
(4,025 Views)

nathand,

 

I'm restarting LabVIEW after updating the dll, and still the function behaves in old way. The only thing that works for me is renaming of the dll, and in this case I can even replace the dll without restarting LabVIEW. But it's annoying. I specify the path in the node configuration, didn't try to pass the path as an input, may be it will do the trick. Will try it tomorrow and update the post.

0 Kudos
Message 5 of 7
(4,022 Views)

Are you sure you don't have the DLL more than one time on the harddisk? Also LabVIEW tries to load the DLL from the path where you browsed to in the Call Library Node (CLN) configuration and if that fails will ask Windows to find the DLL for it. It will then update the path in the CLN to the path Windwos found the DLL in, but if you don't save the VI at that point again, it will still contain the original (non valid) path in the VI copy on disk so if you open the VI later again, the whole game will start again.

 

Also you may be recompiling the DLL on one place yet have a copy somewhere else that gets accessed by LabVIEW instead.

 

But LabVIEW certainly does NOT cache the DLL inside the VI itself and definitely never across LabVIEW restarts. So if you restart LabVIEW and find it access the old DLL version, then this can only be becuase that old version is still somewhere on disk.

 

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 7
(4,008 Views)

When you update a DLL it have to be not in use by another program so CLOSE LABVIEW, reopen, import and update the DLL, then it can be used 🙂

0 Kudos
Message 7 of 7
(2,935 Views)