10-22-2024 03:40 AM
Hi folks,
I am experiencing an issue while trying to load the Thorlabs Kinesis DLL in LabVIEW. The DLL loads successfully when opened from the LabVIEW project, but I encounter a runtime error (Code 1386) when attempting to load it otherwise.
I have referred to several solutions provided by NI, such as creating a .NET configuration file and ensuring that the .NET DLLs are located parallel to the LabVIEW.exe folder, but none of these solutions have resolved the issue.
Upon deep diving into the dependencies of the DLL, I found that it relies on other Thorlabs DLLs. For example, I am working with Thorlabs.MotionControl.DeviceManagerCLI.dll
. My implementation involves using these APIs as sub-VIs in other required VIs, and I have placed the DLLs in a folder parallel to the project. The below is the dependencies of Thorlabs.MotionControl.DeviceManagerCLI.dll
.
The code implementation is I am having APIs with DLLs in it, and I am using these APIs as sub-VIs in another required VIs. I am also having the DLLs in a folder parallel to the project. The below is the screenshot of the Low-Level APIs.
Based on my observation, it seems that LabVIEW may not be able to locate the dependencies of the DLLs, preventing it from loading them correctly.
If anyone has insights or solutions regarding this issue, I would greatly appreciate your help. I’m eager to resolve this as soon as possible. I am also attaching the link from where I downloaded the DLLs Thorlabs - Photonics Products & Solutions.
Thank you!
10-22-2024 09:22 AM
I faced similiar issues with a different set of dlls.
In my case I generated an EXE from the vis, and the dll was on a support folder. WHen running on Win 11 it got an error.
Same thing, calling from a project, the source code worked, but the Exe would not find it.
The workaround solution was to copy the dll into the same folder as the main application.
try coping them on the same location as your main vi and see if works.
10-22-2024 11:26 AM
I've been using Thorlabs DLLs for years.
My solution has been to use a class, not a library, and to add literally every DLL from the Thorlabs program files directory to the class. Yes, over 100 of them. I also copied them all to be in the same folder as the class... they don't need to be called from Program Files.
Additionally, when I build them into an EXE, I change the location of the "data" folder. Normally, and application's default is to put things in two folders:
C:\xxxxx\yyyyy\zzzzz\builds
C:\xxxxx\yyyyy\zzzzz\builds\data
Just change the "data" folder to be "C:\xxxxx\yyyyy\zzzzz\builds" as well.
Finally, in their older versions (but not now) there was an oddity where one of their DLLs was referencing a file that was internally a DLL, but did not have a DLL file extension. I had to include that file as well. I can't remember the file name, but if you look in the directory you get the DLLs from, if there's a file in there the EXACT same size as one of the DLLs, as well as being named the same as well as being named the same apart from the .DLL extension, then that may be an issue on their version.