ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling dlls with dependencies from Labview

I have a problem to call C dll from a labview VI developed with labview 6.1. This dll has been developped in Visual .net and has dependencies on others dlls.
The call to functions from this dll is done by using the function node but it seems my vi and labview.exe don't succeed to load dependencies (dll).
What is the procedure for labview to load dependencies ?
In which directory dll have to be copied ?
Is somebody encountered this problem ?

Thanks in advance for your answer ?
0 Kudos
Message 1 of 6
(3,999 Views)
DLLs that call other DLLs require that the called DLLs are able to be located in the PATH environment variable. A lot of DLLs are located in windows/system32 directory. since this is in the path, they are typically found. I do not remember if the DLLs that are in the same directory are ok and it is just when they exist in different directories not in the PATH variable that there is a problem. There is nothing that LabVIEW can do about the referenced DLLs, they are automatically loaded by the first level DLL.
Stu
Message 2 of 6
(3,998 Views)
french_killer wrote:

> I have a problem to call C dll from a labview VI developed with
> labview 6.1. This dll has been developped in Visual .net and has
> dependencies on others dlls.
> The call to functions from this dll is done by using the function node
> but it seems my vi and labview.exe don't succeed to load dependencies
> (dll).
> What is the procedure for labview to load dependencies ?
> In which directory dll have to be copied ?
> Is somebody encountered this problem ?

LabVIEW is not directly involved in DLL dependency tracking. This is
done by Windows automatically when loading a DLL and seeing that they
need other DLLs. The approach Windows uses is as follows:

1) If DLL is already loaded with that name in the current process use it
2) If absolute
path is given try this
3) Search the directory where the executable for the current process is
4) Search the directory
5) Search the directory
6) Search any directory included in the PATH environment variable

If it completes 6) without any success the referencing DLL is
automatically unloaded causing the LoadLibrary function to fail.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 3 of 6
(4,000 Views)
I'm also having a similar problem as the original poster.  I have an x.dll that depends on y.dll in my C++ code.  For example, a function in x.dll called foo_x() calls a function in y.dll called foo_y().  If I've made a Call Library Function Node using x.dll calling foo_x() function, how can I set up LabView so that it loads y.dll and be able to call foo_y() correctly.  I've placed the y.dll in windows/system32 folder.
 
It is really weird.  I've added a new function called bar_y() in y.dll and made a new function called bar_x() in x.dll.  I've loaded the new x.dll into another computer which has the old y.dll in windows/system32 folder.  I made a Call Library Function Node using the new x.dll calling bar_x() function, but LabView did not give me any errors or crashes.  Since bar_x() suppose to call bar_y(), and my old y.dll does not have bar_y() function, shouldn't there be an error?  Unless, I am suppose to somehow specify in LabView that x.dll depends on y.dll.
 
Please help
0 Kudos
Message 4 of 6
(3,805 Views)


@mudder wrote:
I'm also having a similar problem as the original poster.  I have an x.dll that depends on y.dll in my C++ code.  For example, a function in x.dll called foo_x() calls a function in y.dll called foo_y().  If I've made a Call Library Function Node using x.dll calling foo_x() function, how can I set up LabView so that it loads y.dll and be able to call foo_y() correctly.  I've placed the y.dll in windows/system32 folder.
 
It is really weird.  I've added a new function called bar_y() in y.dll and made a new function called bar_x() in x.dll.  I've loaded the new x.dll into another computer which has the old y.dll in windows/system32 folder.  I made a Call Library Function Node using the new x.dll calling bar_x() function, but LabView did not give me any errors or crashes.  Since bar_x() suppose to call bar_y(), and my old y.dll does not have bar_y() function, shouldn't there be an error?  Unless, I am suppose to somehow specify in LabView that x.dll depends on y.dll.
 
Please help


Again! The calling process does not know about DLL dependencies. It just loads the DLL and Windows on loading the DLL will see that it depends on other external libraries and tries to resolve them. There is NO way in LabVIEW and any other application to tell it that a DLL referenced in a Call Library Node depends on others.
What can make it give you strange results is if you reference that second DLL too somewhere in LabVIEW. LabVIEW might then have loaded that DLL already in memory from somewhere in its search path and when your second DLL is loaded Windows sees it references a DLL already in memory and simply resolves references to the function to that DLL.

The explanation you give in your last sentence makes simply no sense. It's not how Windows DLL loading does work nor could work and therefore I can't see how something like what you describe could happen.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 5 of 6
(3,792 Views)
you are correct, I found the dll in another location.  Thanks for the help!  Sorry for sound so foolish.  I'm still trying to figure out LabVIEW, just started using it...
0 Kudos
Message 6 of 6
(3,788 Views)