LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dll Library Call Function Node, vi must be in same folder as DLL

1) I have a very simple Library Call Function that calls up  CondorMeasure.dll and, in turn, calls up an io.dll for a piece of equipment we are testing.

 

The two DLLs must be placed in the same directory to function properly.  The CondorMeasure.dll has several functions, but the CondorMeasure_Init fuction must be executed first with the proper parallel port address.  If does not detect the io.dll in same directory, it will return a -1. It returns a 0 if it is ok.  The next required step is to turn on the PSU (the device), and then issue commands as needed.

 

The DLLs work fine when called from a working C executable file, and a working Python file.  It works fine in LV until the vi is saved, and LV is closed.  When exectuted after LV is closed, itdoesn't work, returning a "-1" error.  However, If I have the vi in the same folder as the DLLs, it works fine. Any idea how I can I can maintain the original working directory of the DLLs  without having to have vi and DLLs in the same folder?

 

Enclosed, is a simplified version of the vi that only contains the initialization function and turn-on function. 

 

 

2) Another annoyance is that once saved, the browse path cannot be changed to another version of the vi.  Once saved, it always reverts back to the first location the call node was pointed too.  It seems this may be a common issue.  I didn't see a fix for this yet, has this issue been resolved?

 
 
See enclosed files, for DLLs, vi, and reported error code

Message Edited by ewtotem on 10-17-2007 06:33 PM

Message Edited by ewtotem on 10-17-2007 06:39 PM

0 Kudos
Message 1 of 3
(2,946 Views)
You have to enter the complete path to the DLL in the call library node. LV 8.5 lets you input the path as a parameter on the icon of the call library node.

If you only enter the dll name the VI searches in its own directory and also system32.

André
Regards,
André (CLA, CLED)
0 Kudos
Message 2 of 3
(2,920 Views)
often in older version of LabVIEW the system would search in the wrong place for dlls etc.

You can (at run time) use the kernel32.dll in c:\windows\system32 directory and the SetCurrentDirectoryA() function. If you set the current directory to the same as where your DLLs reside then all should be happy!

the function prototype is:

short int SetCurrentDirectoryA(CStr arg1);

cheers
Neil

Message Edited by nrp on 10-18-2007 01:21 PM

0 Kudos
Message 3 of 3
(2,911 Views)