12-03-2013 04:33 AM
Hello,
I have a problem with calling a DLL from a relative path while using the Call Library Function.
At the beginning I used an absolute path because it was faster/easier to test the VI, but since the program has to work on other user accounts etc. and has to be compiled as *.exe this is no longer an option and I have to use relative paths.
In _main_path the main VI-path gets written as global var and I combine the paths to where the DLL is stored (see fig1).
The created path is correct (since I use this construction method in other parts of the VI as well and it does what it should do there), the DLL exists there under its name; reviewed it a 1000 times and the file-existing VI also says it exists, so that’s not the error here 😉
The error message is shown in fig2:
Why does this way of creating the link to the dll not work? When click to properties of the Call Library Function and set the path to the DLL manually everything works just fine as it did before.
SW used: LV 2011 SP1, W7 64 Bit
br
Stefan
12-03-2013 05:38 AM
12-03-2013 05:49 AM - edited 12-03-2013 05:49 AM
Hi udka,
i know the pitfall you are refering to (trapped in it a long time ago ;)), but the problem in this case is not in the exe but in the VI.
The problem exists while running it as normal VI, thats what confuses me...
br
stefan
12-03-2013 06:02 AM
12-03-2013 07:26 AM
Hi,
there is no link in your post?! 😉
br
stefan
12-03-2013 07:49 AM
12-04-2013 07:38 AM
You may have a race condition. Is your global variable populated before you use it?
Another way to solve this is to put the DLL in the system search path (e.g. next to your EXE or in the system folder) and specify only the name in the DLL call. This will give you better performance if you call the DLL more than once.