Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Different performance for handling DLL function

Hi, all
I have some question about handling DLL function.
There is two test cases for the DLL handling for experiment.

Platform is as following:
Windows 98, LabWindows/CVI 5.5 (compatiable with Virsual C++), DLL library (built by C++ Builder 960 kbytes).

Case 1:
Use the LoadLibrary to load the DLL library (DLL_handle) and use the function (provided by DLL) to handle the COM port (COM_handle). And there have a hardware key for security check. For each command (provided by DLL) take 0.25 second to finish one command to handle the RS232.
Case 2:
Use LoadLibrary to load the DLL library (DLL_handle) and use the function (provided by DLL) to handle the COM port (COM_handle). And there
have a hardware key for security check. There have three threads working (use CreateThread to create with 1MB stack size), and pass the DLL_handle and COM_handle to the static libarty to do the desired job (took 1 second to finish the job for one command). In the static library, there use the DLL_handle to get the pointer of the selected function and use COM_handle to handle the RS232.

I don't know the reasons between these two cases.

If you have any suggestion or solution about it , please tell me detail.

Thanks,

Lambert Lin

My email address is lambert_lin@dbtel.com.tw
0 Kudos
Message 1 of 2
(3,380 Views)
Sir,
We do not have an exact idea of what your application is doing. However, it looks like the difference between the two cases is the use of multithreading in the second. It is possible that the delay is from the CPU having to "switch" between threads, and having to load and execute calls to the DLL once in the thread. I think you should look carefully into the structure of your applications multithreading to see if there are areas which could be causing delays in the execution of the DLL's functions.
0 Kudos
Message 2 of 2
(3,380 Views)