Differences between using MFC in a shared DLL and using MFC in a static library

Source: Internet
Author: User

When vs2008 is used, there is one of the following MFC settings in the project properties:

1. Use the standard Windows library 2. Use MFC in the shared DLL 3. Use the first type of MFC in the static library as the name suggests. The second type means that the content of some mfc dll files is not included in the EXE files during packaging, so the EXE files are small, but related DLL files are required in the system during running. The third is to write the relevant code in the DLL into the EXE file. The file is large, but it can be run on a machine without the relevant DLL. At the same time, if the program was originally the second method, it could be sent to a colleague, and when running on the colleague's machine, an error may occur: "The program cannot be started ......, Failed to start the application because the application configuration is incorrect ." I think it is better to select 3rd types of programs in the development stage. You don't need to worry about the size and efficiency. You can use other tools such as spy in later packaging, to detect the DLL. Http://blog.csdn.net/xiexievv/article/details/6314874)

"Using MFC in shared DLL" means that the content of some mfc dll files is not hardcoded into the EXE files during packaging, so the EXE files are small, however, related DLL files must be included in the running system environment.

"Using MFC in a static library" is to hard encode the relevant code in the Lib static library corresponding to the DLL to the EXE file, the file is large, but it can run on a machine that has not been included in the DLL. Of course, even so, not all the DLL files will be hardcoded into the EXE, so some DLL files are still required. for example, some DLL in the redistributable package.

The executable files compiled in the static library can be run on other machines. The executable files compiled in the shared dll can be run on the local machine, if it is obtained from other machines, the corresponding dynamic library is required.

In addition, the project size under the shared dll will be slightly smaller, but when running on another machine, make sure that there is dynamic library support on that machine.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.