02-16-2023 04:14 AM
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.
Solved! Go to Solution.
02-16-2023 04:44 AM
@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.
02-16-2023 04:53 AM
I wanted to separate this from the other topic. Solved there.