11-16-2021 12:32 AM
Hi ,
I always encounter this Call library function node error every time after I open the Vi file and run it.
The error is
" Call library function node 'TML_lib.dll:_TS_GetInput@8':Library not found or failed to load"
Even though I have selected the correct path for the dll file and saving it.
It will work until I close it again.
I will get it again after I close it and open the vi file and try running it again.
How can I resolve this. I am new to LabView.
Solved! Go to Solution.
11-16-2021 01:19 AM
Try this:
https://labviewwiki.org/wiki/Call_Library_Function_Node
However give more information about how you have set the calling.
11-16-2021 03:39 AM
Thanks. It works.
11-16-2021 03:46 AM - edited 11-16-2021 04:33 AM
Hi Kit73,
blind guess, but maybe the bitness incompatibility? Running 32 bit DLL in 64 bit version of LabVIEW and vice versa.
//EDIT: Sorry, didn't seem that it's already resolved (I mean it wasn't when I started to write the original post 😄 )
11-16-2021 05:26 AM - edited 11-16-2021 05:30 AM
This is typically caused by a shared library (DLL) that depends on other shared libraries contained in the same folder.
Windows explicitly does not search the directory from which a shared library is loaded for further dependencies. BUT there is a quirky implementation in the shared library loader that does use the process current directory to look for such shared libraries. And this current directory is changed by the Windows file dialog to the directory when the dialog is dismissed by the user with a file or directory selection.
So what happens is this:
- Assume we have two DLLs, A.DLL which we want to call and also depends on B.DLL which is in the same directory.
- The process current directory is set to some location, by default the directory where the executable resides that started the current process, so this would be "C\:Program Files (x86)\National Instruments\LabVIEW 20XX" but if you used any file dialog in LabVIEW since startup, it will be instead set to that directory you last opened a file from or saved a file to.
- LabVIEW tells Windows to load A.DLL from the directory where your VI references it. Windows encounters that this DLL also needs B.DLL and goes through its search directories to find it. But it can't be found and Windows returns an error to LabVIEW that the DLL was not loadable, which causes the error dialog you see.
- You go and select the A.DLL in the LabVIEW file dialog, which is the standard Windows file dialog.
- Unseen by you this dialog changes the current directory to that same directory A.DLL is in.
- LabVIEW tells Windows again to load A.DLL and suddenly Windows can also find B.DLL => success
The solution with defining the path dynamically from the diagram works because in this case LabVIEW seems to do some extra voodoo to tell Windows to also use that directory as search location, but it can't do that for the case with the library path defined statically as that could cause bad backwards compatibility problems with VIs upgraded from older LabVIEW versions. The dynamic path also has the problem that you need to properly compute it. You can't use a static path as that would not adapt when you move the entire project to a different location and also will fail when you build everything into an exe file.
A better solution would be to make sure those DLLs are all in a location where Windows can find them and in LabVIEW only reference A.DLL by name instead of a full path.