How to replace the dynamic library of application DLL (gts. dll is used as an example), dllgts. dll
Under the C ++ builder compiler IDE Software
1. View-Project Manageer -- find the x. lib (gts. lib) corresponding to the x. dll to be replaced, and then Remove
2. Project-Remove from project -- check whether the dll exists. If yes, Remove
3. Select either of the two steps. After compilation, you can see the following error
[Linker Error] Unresolved external "GT_AxisOff" referenced form... file... path...
GT_AxisOff is the function in the removed dll (gts. dll ).
4. Delete x. dll, x. lib, and x. h x. h ~ in the project file directory ~
After compilation, you can see the following error: E2209.
[C ++ Error] motionCtrl_GTS.h (6): E2209 Unable to open include file 'x. h' (gts. h): ::::: motionCtrl_GTS.h is used to gts. h file
When compilation errors occur, no exe files exist in the project file \ DEBUGS \.
5. Delete x. dll, x. lib (gts. dll, gts. lib) under the project file \ DEBUGS \ directory)
After compilation, You can see ErrorE2209, which is the same as step 1.
6. Add the new x. dll and x. lib x. h to the project directory.
After compilation, you can see the following errorE2268:
[C ++ Error] motionCtrl_GTS.cpp (48): E2268 Call to Undefined function 'gt _ SetAxisAsLaser'
Error message: this is because of the new gts. the dll does not contain the earlier version gts. the 'gt _ SetAxisAsLaser 'interface of the dll function. Therefore, an error will be reported when this function is used in the original program (this is a further update after the dll is replaced)
Compare the operation process and compilation result of step 1 and Step 2
7. Add x. dll and x. lib to the project file \ DEBUGS \ directory.
After compilation, You can see errorE2268, which is the same as Step 1:
At this time, we should note that the [Linker Error] Error is reported after we Remove Step 1 or step 2 after we complete Step 2 and step 2 (.. to be continued ..) no [Linker Error] is reported when you add to project.
In fact, it is not because there is no [Linker Error] Error, but the cause of the compilation process. When a 6th-step Error is compiled, the compiler does not perform further compilation.
Assume that the new gts. the dll fully covers the old gts. dll. At this time, we compile the program and will not generate Step 1 errors, but will generate Step 2 or step 2 errors after compilation [Linker Error]
8. Project-Add to Project -- select the file type ang file (*. *) in the displayed dialog box, locate gts. lib in the Project file, and click open.
After compilation, you will see that the compilation is successful and there are no errors.
Open the project file \ DEBUGS \ and we can also see the exe file generated for the project program. Double-click OK to run it. No problem
The complete implementation of the DLL replacement process. This is a step-by-step process. I hope to help my friends in need.