LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Application Ending Problem?

My problem is I connect to a DLL/library through a function call to the DLL interface.
 
I then run my application and have a exit button that closes my connection that I established with the DLL through another function call associated with that DLL.
 
The real problem that I am having is that the program exits very slowly (about 5 - 10 seconds before the application finally stops running), and after exiting the program, I modify the software and try to rebuild the executable and I get the error message "Unable to open file C://///", "Access permission denied." 
 
As it turns out, when I got to the Windows Task Manager screen and select processes, my application is still running and it takes a long time to kill the application using the end process button in the Task Manager.
 
I am wondering if it is a DLL issue or something else is keeping the program from exiting. Has anyone ever had this problem before or no of a way I can try a debug what is causing this issue? The one other odd thing is the function calls to the DLL all return back good results.
 
Thanks in advance.
0 Kudos
Message 1 of 7
(3,558 Views)

What kind of connection do you establish to the DLL?

Did you create the DLL?  Or someone else in your compny?  Or did you buy it?

What do you do in your application as it is exiting?  Do you try to write to a file?

Can you run your application without calling the DLL functions?

Do you have a UIR?

Do you have a close control on your main panel?

Can you post the callback for your close control?

Do you have a long loop in one of your callbacks?  Callbacks must return before responding to your close control.

Is your application multi-threaded?

If your application uses RunUserInterface and QuitUserInterface, put a breakpoint on QuitUserInterface and single step from there.

0 Kudos
Message 2 of 7
(3,542 Views)

What kind of connection do you establish to the DLL?

The way I establish a connection to the DLL is through the .lib file that I created using the .h and .dll file.

Did you create the DLL?  Or someone else in your compny?  Or did you buy it?

The DLL was created by another company and the only file that I have from the other company is a dll, h, and lib files.

What do you do in your application as it is exiting?  Do you try to write to a file?

When I comment out the code that closes the DLL, the application exits out and the process ends. But with the DLL disconnect in my code, the program hangs up and the process does not end.

Can you run your application without calling the DLL functions? Yes and the application works without a problem.

Do you have a UIR? Yes

Do you have a close control on your main panel? Yes, it is an exit button.

Can you post the callback for your close control?

Do you have a long loop in one of your callbacks?  No, there is no loop in the callback.

Callbacks must return before responding to your close control.

Is your application multi-threaded? No

If your application uses RunUserInterface and QuitUserInterface, put a breakpoint on QuitUserInterface and single step from there. I will give that a try.

I am just wondering if there is a compatbility issue between the header file and dll that when I call the close or disconnect with the DLL it hangs up.

Thanks

0 Kudos
Message 3 of 7
(3,514 Views)

Specifically, what functions do you call to connect to the DLL and then disconnect from it?  LoadLibrary and FreeLibrary?  Some functions native to the DLL?

It you're using function from the DLL to disconnect, do you have any documentation on that function?

Have you tried running the code  while logged on as an admin?

0 Kudos
Message 4 of 7
(3,502 Views)
As it turns out right after I posted the answers to your email, I rebooted my computer and tried stepping through the QuitUserInsterface Function and from that point on I have been able to successfully exit the program without any problems.
 
I cannot really explain what the problem was other than the application was in an unknown condition and rebooting clear the problem.
 
Now my only problem is being able to utilize the DLL. It is tough trying to interface through a DLL that you did not develop nor can you ask the developer questions about it.
 
Just one quick question though, using CVI do I have to LoadLibrary and FreeLibrary if the lib file is in the directory where my application is located?
 
I thought as long as my application can access my library then I should be able to make calls to the DLL without Loading the library, is that correct?
 
Thanks for the help.
0 Kudos
Message 5 of 7
(3,498 Views)

You do not need to LoadLibrary and FreeLibrary if you are statically linking the DLL and include the .LIB file in your project.

I asked about them because I don't what you are doing to "connect" and "disconnect" the DLL.

Message 6 of 7
(3,494 Views)
You should not need to call any "LoadLibrary" or "FreeLibrary" kind of
functions for using a DLL that comes with a lib file.
You simple add the .lib file into your project and include the .h file
in your code and start using the DLL functions.
That's what I have been doing for some time, and it works OK if the DLL
was created in a compatible environment.

On Jan 22, 8:40 pm, geek <x...@no.email> wrote:
>As it turns out right after I posted the answers to your email, I rebooted my computer and tried stepping through the QuitUserInsterface Function and from that point on I have been able to successfully exit the program without any problems.
>&nbsp;
>I cannot really explain what the problem was other than the application was in an unknown condition and rebooting clear the problem.
>&nbsp;
>Now my only problem is being able to utilize the DLL. It is tough trying to interface through a DLL that you did not develop nor can you ask the developer questions about it.
>&nbsp;
>Just one quick question though, using CVI do I have to LoadLibrary and FreeLibrary if the lib file is in the directory where my application is located?
>&nbsp;
>I thought as long as my application can access my library then I should be able to make calls to the DLL without Loading the library, is that correct?
>&nbsp;
>Thanks for the help.

0 Kudos
Message 7 of 7
(3,468 Views)