| |

VerySource

 Forgot password?
 Register
Search
View: 842|Reply: 8

Regarding the problem of calling the dll multiple times (there are global variables in the dll).

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-27 09:40:01
| Show all posts |Read mode
Using other people's dlls, dlls are more complicated. There are many global variables in dlls. It takes about 20 minutes to dynamically call a dll to execute it once. The dll is running normally and there is dll source code. The dll is not easy to change, and the code is a bit complicated.
   Now I have a problem. When I perform an operation on an IP address, when I call this dll, the process ends immediately when I click the stop button (need to release the dll?). And immediately I want to perform the same operation on another IP, and also need to call this dll.

Is it necessary to release before the second call? Another problem is that the normal information cannot be obtained when the dll is called for the second time. How to solve it?
Reply

Use magic Report

0

Threads

12

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-2-19 18:30:01
| Show all posts
DLL global loading is fine
Reply

Use magic Report

0

Threads

55

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-3-5 13:00:01
| Show all posts
Then load the DLL by importing it, just once.
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-3-7 11:45:01
| Show all posts
There are many global variables in dll! !! If it is not released, the next call will be wrong! Is there any good solution.
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-3-8 05:00:01
| Show all posts
There are many global variables in dll! !! If it is not released, the next call will be wrong! Is there any good solution.
-------------------------------------------------- -------

Then use it once, load it once, then release it once, use LoadLibrary and FreeLibrary
Reply

Use magic Report

0

Threads

12

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-3-8 13:30:01
| Show all posts
I suggest you change it, since there is code, or the problem will be bigger in the future
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-3-8 20:00:01
| Show all posts
Add an initial function to the DLL to initialize these global variables
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-3-8 22:00:02
| Show all posts
It takes 20 minutes to execute my dll. If I click the stop button after running for 3 minutes, the program will be abnormal if it is FreeLibrary.
drop out.
If it is not FreeLibrary, the operation of another ip immediately after calling this dll is abnormal, it may be that the dll global variable is not the initial value! !!
Reply

Use magic Report

0

Threads

70

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-3-9 15:00:01
| Show all posts
It takes 20 minutes to execute my dll once. If I click the stop button after running for 3 minutes and then FreeLibrary, the program will exit abnormally.
If it is not FreeLibrary, the operation of another ip immediately after calling this dll is abnormal, it may be that the dll global variable is not the initial value! !!

If the problem you said should be because
1. The dll itself is defective. Need to be modified
2. It may be that you did not call the function in the dll according to the convention. For example, when you start a new execution operation, you need to call a fixed function. The dll uses this function to initialize the relevant variables (if the dll does not provide such a function, it should be (the design of the dll is flawed)
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list