LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL needs to be in the same folder as LabView85.exe

I initialise a spectrometer using a call to a dll through a call function library node. The dll was supplied with the spectrometer (which also came with its own stand alone software) and was installed in the spectrometer folders in C:\Program Files\Spectrometer. The standalone software works fine. However my labview code does not initialise the spectrometer properly if I point the function node to same copy of the dll.

 

In order to get my code to initialise properly I have to

a)      put a copy of the dll in the same folder as Labview85.exe

b)      reset the path in the call library function node every time I open my code (ie browse and reselect the dll that the node is already pointing to and click OK)

 

Any ideas why this is?

 

I am considering using the ‘Specify path on diagram’ option to see if this would make a difference and allow me to point to the dll in C:\Program Files\Spectrometer but since I have many function nodes that I would need to change I would like to know if there is another fix, before ploughing ahead.

 

I use calls to other dlls in the same program and these work fine wherever the dll is located.

 

Thanks in advance

Dave

0 Kudos
Message 1 of 16
(3,803 Views)
Hi Dave,
do you develop on different computers? Try to remove all copies of the dll and link only to the original, which comes with the installation of the device.

Hope it helps.
Mike
0 Kudos
Message 2 of 16
(3,792 Views)
Yes I develop on 2 different PCs. I've just looked and seem to have loads of copies of the dll. I will try removing them all except the one I want and see what happens.

Thanks
Dave
0 Kudos
Message 3 of 16
(3,769 Views)
have you got worked it out?
 
0 Kudos
Message 4 of 16
(3,751 Views)
I have removed all the dll copies except one and the call function library now points to that dll (in the spectrometer install directory)

Not yet I'm afraid

It still does not work - I have to open the call function node, click browse, reselect the dll, and click ok. Then it will detect the spectrometer.

I tried specifying the path on the diagram. This does not work either...unless I use the browse button of the path control itself and reselect the dll, or open the call function node, browse and reselect the dll from there (even though I specify the path on the diagram). Then it does work.


On the call finction node if I use 'default' error checking  then no error is reported. If I select 'maximum' then I get error 1097 which is...

'An exception occurred within the external code called by a Call Library Function Node. The exception may have corrupted LabVIEW's memory. Save any work to a new location and restart LabVIEW. Verify the values you wired into the Call Library Function Node.'


On the occasions when the spectrometer is not initialised the return value from the function called in the dll does not say it encountered any error, it just doesn't detect the spectrometer.


Dave
0 Kudos
Message 5 of 16
(3,739 Views)
Hi,

Just wondering if anyone had any more ideas on this?

To reiterate the problem:

I initialise a spectrometer with a call to a DLL using a call function node. The DLL that is (now) called is the one that was installed by the spectrometer in a folder in the c:\program files directory. There are no other copies of the DLL on the PC (previous copies have either been deleted or renamed)

If I load LabView and open my vi and run it the spectrometer does not initialise properly. In order to get it to work I have to open the call function node, click browse, reselect the DLL and click OK. Then when I run the VI everything works fine. I don't know why I have to reselect the DLL, since in effect I haven't changed anything in the VI.  Although the vi where the DLL call is made is a subvi and when I close it I am prompted to save the (phantom?) changes.

I have tried specifying the path to the DLL on the block diagram, both as a constant and as a control. This does not work either, but if I use the control's browse button to reselect the DLL and then run the vi it does work.

If I stop and start the vi then it all works again. It is only if I shutdown and restart LabView  that I have to reselect the DLL. It seems that LV is losing the path to the DLL or 'forgetting' that it exists.

Any help is greatly appreciated.

Thanks
Dave
0 Kudos
Message 6 of 16
(3,678 Views)
Hi Dave,

By design, LabVIEW will only search in certain locations for DLLs at runtime.  There is a KB article outlining the directories in which LabVIEW will attempt to locate the variable.  I believe the solution for you will be to create an environment variable in your autoexec.bat.  I hope the KB article will lead to a solution for you.

Kind Regards,

Justin Fuller
National Instruments
0 Kudos
Message 7 of 16
(3,670 Views)
Hi Justin,

I'm afraid it doesn't help much at the moment. I haven't got to the stage of building an executable yet (although I will do in the future...hopefully). I get this problem in the development environment.

Elsewhere in my program I call other VIs that live in the same folder and I don't have a problem with them.

Thanks
Dave
0 Kudos
Message 8 of 16
(3,666 Views)
Hi Dave,

I apologize for misunderstanding the first go around.  In order to prevent LabVIEW from prompting for the DLL path each time you execute, the location of the DLL must be added to the VI Search Path in LabVIEW.  Here are the steps for accomplishing this:Open a new VI in LabVIEW.
  1. Select Tools » Options. Select Path and VI Search Path from the pulldown menus.
  2. Uncheck the Use Defaults checkbox.
  3. Use the Browse button to select the path to the directory in which you are storing the DLL.
You can find more details about the issue here.

Regards,

Justin Fuller
National Instruments
0 Kudos
Message 9 of 16
(3,661 Views)
Hi Justin,

I will try this tomorrow, but I don't believe this is the problem, becasue...

a) The VI opens fine, it does not prompt me for the DLL path.
b) the VI runs fine, when it gets to the call function library node it reports an error only if error checking is set to maximum (see post 5). It appears to find the DLL and use it but the spectrometer does not initialise. In fact the program fails to find a spectrometer connected to the PC.
c) I have other DLLs in other folders in C:\Program Files, and these all work fine.

I can fix the problem by going into the block diagram, opening the call function node, browsing & reselecting the same dll as already specified in the Path window and clicking OK.

Anyway I'll give it a go Smiley Happy
Thanks for your help
Dave


0 Kudos
Message 10 of 16
(3,646 Views)