LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dll works in project but not in executable

Solved!
Go to solution

I have a problem with third party DLL that I'm using for my project.

It controls a device connected to USB port and reads the sensor data.

When I'm starting vi from the project it shows correct result:1.PNG

But after creating application I'm getting different value on the same computer:

2.PNG

 

The dll that I'm reading is moved to data folder after building exec

The code I'm using is rather simple:

3.PNG

 

Please help

Download All
0 Kudos
Message 1 of 8
(5,482 Views)

Remove the path from the Call Library function and then put the DLL in the same directory as your EXE. 

aputman
0 Kudos
Message 2 of 8
(5,443 Views)

Hey

 

Do you mean like that?

1.PNG

 

I have a broken Run Arrow:

2.PNG

 

Should I set something more?

 

 

I also tried this:

1.PNG

but it didn't change anything. It has the same result at vi and exec 😕

0 Kudos
Message 3 of 8
(5,438 Views)

No, remove the path, not the filename.

aputman
0 Kudos
Message 4 of 8
(5,421 Views)

Hi

So I've done this:

2.PNG

 

I moved this dll to where vi was, after starting vi, I didn't get correct results (different that the two before)

After creating application, I moved dll from data to where exe was but I've got the same result as before (this big number, that was not ok)

0 Kudos
Message 5 of 8
(5,419 Views)

Put indicators on your front panel after all of the DLL calls to see which ones are wrong.  The Units DLL call doesn't have the GM0.dll reference in the name.  Is there something about that call that is different than the others?  

aputman
0 Kudos
Message 6 of 8
(5,413 Views)
Solution
Accepted by topic author siadajpan

First guess: this dll uses another dll that is originally next to it. Labview puts near build only top level dll, it looses connection to all others.

Try to specify absolute path to original dll, not relative to exe.

Second guess: some error happens in the first call, because com-port is not closed (I see "start-connect", but not "close" function), it gives wrong number.

Connect errors and check for errors, verify output after all dll calls

0 Kudos
Message 7 of 8
(5,400 Views)

Hi

 

Thanks for ideas

 

Yes, it seems like there were another dlls that the original dll made a call to.

I've done relative path and put all to folder with exe. 

I've also moved them to system32 folder, does this makes a difference?

It appears like now it sometimes works straight away, sometimes after couple tries, but I guess this is related to some other issue, maybe, as you suggested, because connection is not closed properly.

 

Thanks again for your time and ideas

0 Kudos
Message 8 of 8
(5,362 Views)