Differences between ATL. MFC. CLR in Visual C ++

Source: Internet
Author: User

MFC, ATL, and CLR are the three built-in libraries of VC2005, covering various development methods and applications of windows. Of course, there are more than three libraries for C ++ development, but these three are recommended by Microsoft. From the programming level, WIN32 is the lowest layer, followed by MFC. Then the CLR. WIN32 winAPI MFC class library CLR. net Library

1. WIN32 is a program that uses API functions instead of MFC.

2. the MFC Library has a history of many years. The MFC is a simple encapsulation Based on Windows APIs. Its core architecture is based on the "Document/View" Architecture (a concept that was considered quite trendy 20 years ago) and message flow mechanism. This library has not changed much since VC6. The range of MFC encapsulation includes GUI, IO, database, and network programming. However, many System Development APIs are not encapsulated, so developers generally process their own business-related tasks on the basis of MFC. In fact, many people use MFC only to encapsulate the GUI. The GUI processing efficiency of this library is not very high. Sometimes the Code related to UI processing accounts for half or more of the entire project. In general, this is an old database. In the past 10 years, Microsoft has not made major improvements or updates in addition to repairing and completing MFC. If you ask how long will MFC still survive? Well, this is a problem. If one day the MFC is gone, Microsoft will not be able to replace it with other products at this level.

3. the CLR library is a library released with. Net Framework 2 and VS2005. Its core implementation is the same as that of C # And VB.net. All are based on the public Language Runtime Library .. Net Framework encapsulates a large number of system APIs and provides them to developers in the form of class libraries. The CLR library in C ++ can use the part related to the local code. Currently, C ++ does not involve the asp.net part. The C ++ In the CLR library subverts many standard C ++ traditions. It can be said that C ++ is not C ++ here, just do other things with C ++. C ++ is more like C # or similar language. Therefore, C ++ is not called C ++, but C ++/CLI. It is worth mentioning that the C ++/CLI section is not accepted by standard C ++ yet, recently, Microsoft's C ++/CLI standardization proposal was rejected by the C ++ Standardization Committee. Therefore, C ++/CLI is still Microsoft's statement.

4. ATL is used to compile COM programs. The ATL library seems to be very old, at least it exists when I access VC. This library can be traced back to COM components, because ATL aims to help developers better interact with COM. When is there a COM object? I don't know. I only know that COM has a 16-bit version. When Windows is upgraded to 32-bit, COM is upgraded to 32-bit. COM is like some encapsulated class objects. By encapsulating system APIs, some standard methods are provided for you to use. So what components are in the system can be used in ATL. Therefore, ATL can not only write ActiveX, but also have window or other functions. Sometimes some functions released by Microsoft are only released in the form of COM components, such as MSXML. At this time, MFC is not suitable and should be processed by ATL. However, ATL is not very strong in processing the UI, So Microsoft engineers have an open-source UI framework called WTL, which is specially used to process the UI. The disadvantage of the ATL library is that, as a template library, it will be troublesome when an error occurs, and the error prompt will not be right.

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.