LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL call cannot find/load another DLL

Solved!
Go to solution

Hello!

I have a DLL that I call from LV. That specific function call is supposed to load another DLL being in the same directory, but it won't. The call returns an error that says it couldn't load the other DLL. The same thing in a Visual Studio compiled EXE calling the main DLL works.

 

I can't figure out how to solve this. Please help.

0 Kudos
Message 1 of 3
(1,015 Views)
Solution
Accepted by MaSta

@MaSta wrote:

Hello!

I have a DLL that I call from LV. That specific function call is supposed to load another DLL being in the same directory, but it won't. The call returns an error that says it couldn't load the other DLL. The same thing in a Visual Studio compiled EXE calling the main DLL works.

 

I can't figure out how to solve this. Please help.


As explained in your other thread that is not how Windows DLL loading is working. The directory where your DLL is located is NOT a privileged directory that is searched by Windows if the DLL is requested by name only. If your DLL wants to be able to load another DLL from the same directory it is located in, it has to do so explicitly by determining its own directory, appending the desired DLL name and then loading it through LoadLibrary(). And that also means to link explicitly to all functions in wants to call by using GetProcAddress(). Import libraries only require DLLs by its name and then standard Windows search rules apply.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 3
(1,001 Views)

I wanted to separate this from the other topic. Solved there.

0 Kudos
Message 3 of 3
(992 Views)