Qt library packaged weight-loss method

Copyright: https://blog.csdn.net/nicai_xiaoqinxi/article/details/91348605

Use windeployqt program to generate libraries are large, even an empty program. Compare for a moment the program, some libraries did not use but also come packaged. This article provides a knockout extra libraries in order to achieve weight-loss method.

  When a program opens run time, if the library is missing, the system will pop up the corresponding library could not find a prompt dialog box. Why is this so? Because the program runs before the first loads a dynamic library section into memory for running calls.

  The use of reverse thinking, the same way we will program up and running, and then delete the library in the program directory, you can delete it if there is no certification process to use the library, if the library is being used can not be deleted. Using this feature can be part of the library removed.

  Of course, this approach does not really fly, action is not recommended. We need to learn is the reverse operation of thinking, programming and sometimes need a little bit of trans-operation is to find the fun in it. On the one hand qualitative thinking is the biggest advantage to learn programming, on the other hand is the biggest drawback. Reverse operation in life can often wonders, such as shampoo upside down, seemingly absurd (think of this scenario is somewhat funny), but he can perfect solution to the problem of shampoo need to close your eyes.

The right way

  • Use windows interfaces CreateToolhelp32Snapshot, it can for the specified process, process heap through the process of obtaining information, module, thread to create a snapshot.
  • Through the acquisition process with a dynamic library calls to perform accurate eliminating unnecessary library.

Guess you like

Origin blog.csdn.net/nicai_xiaoqinxi/article/details/91348605