TobyD Posted November 29, 2007 Report Share Posted November 29, 2007 I've been struggling with a problem. Hopefully I can explain it accurately. :headbang: I have a .dll that I am making function calls to to communicate with a USB instrument (all call library function nodes are wrapped in individual sub VIs). The only way I can get LabVIEW to "see" the instrument on USB is to close my program, move the dll out of the expected location, load the program (LabVIEW can't find the dll), and then move the dll back to its original location and browse to it. I am then able to access the instrument without problems until I close LabVIEW (I can close and reopen my program and it still works). When I reopen my program I have to go through the "hide the dll" game to get it to work again. Any idea what I might be doing wrong? Do I have to add the dll path to my system path variable? -Toby Quote Link to comment
Rolf Kalbermatter Posted November 30, 2007 Report Share Posted November 30, 2007 QUOTE(TobyD @ Nov 28 2007, 02:59 PM) I've been struggling with a problem. Hopefully I can explain it accurately. :headbang: I have a .dll that I am making function calls to to communicate with a USB instrument (all call library function nodes are wrapped in individual sub VIs). The only way I can get LabVIEW to "see" the instrument on USB is to close my program, move the dll out of the expected location, load the program (LabVIEW can't find the dll), and then move the dll back to its original location and browse to it. I am then able to access the instrument without problems until I close LabVIEW (I can close and reopen my program and it still works). When I reopen my program I have to go through the "hide the dll" game to get it to work again. Any idea what I might be doing wrong? Do I have to add the dll path to my system path variable? -Toby Could it be that your DLL calls indirectly other DLLs that are in the same directory? When LabVIEW asks Windows to load a library at a specific path Windows does attempt to load it, and when that library references other libraries it tries to load them too. If one of those referenced library loads fails the entire load fails and Windows tells LabVIEW: sorry! Now Windows will search for libraries in following order: 1) a library with the same name is already mapped in the process space 2) inside the directory where the executable for the current process is located (here the directory where LabVIEW.exe is) 3) in the System directory 4) in the Windows directory 5) in any directory mentioned in the current PATH environment variable and most possibly also in the "current directory". The current directory is a process specific global variable that gets manipulated by various Windows APIs. One of them is also the API that LabVIEW uses to display the System File Dialog. So if you browse to your DLL directory to tell LabVIEW which DLL to load and that DLL references other DLLs implicitedly that are in the same directory, Windows suddenly will find them, but not before. Solution would be either to move those DLLs all into a location that is properly searched by Windows, or add the location of that directory to the PATH environment variable. Rolf Kalbermatter Quote Link to comment
TobyD Posted November 30, 2007 Author Report Share Posted November 30, 2007 QUOTE(rolfk @ Nov 29 2007, 02:15 AM) Could it be that your DLL calls indirectly other DLLs that are in the same directory? That sounds like what is happening. I know the dll in question does call three other dlls that I have in the same directory. I'm not at work today so I can't test this out, but I'll update this post when I know something. Thanks ! Quote Link to comment
TobyD Posted December 1, 2007 Author Report Share Posted December 1, 2007 QUOTE(TobyD @ Nov 29 2007, 09:33 AM) I'll update this post when I know something. I don't see an option to edit my last post - I guess there must be a time limit on that feature? Anyway...That did the trick. I added the directory to my system path variable (had to reboot for changes to take effect) and now it works as expected. Yay! :worship: Quote Link to comment
Justin Goeres Posted December 1, 2007 Report Share Posted December 1, 2007 QUOTE(TobyD @ Nov 30 2007, 10:42 AM) I don't see an option to edit my last post - I guess there must be a time limit on that feature? If you http://forums.lavag.org/index.php?act=paysubs&CODE=index' target="_blank">purchase a Premium Membership you can edit your posts FOREVER!!! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.