. NET short talk about interoperability (1: Introduction At the beginning)

Source: Internet
Author: User

Series of articles on interoperability :. NET (1: Introduction ). NET (2: Faster first ). NET (3: The DllImport feature of basic knowledge ). NET (4: Basic knowledge-based Dispose unmanaged memory ). NET (5: Basic knowledge-based Dynamic platform call ). NET (6: Improving platform calling performance based on basic knowledge ). NET (7: Introduction to data sending)

I recently learned about the technology of non-hosted C ++ interoperability, but I am not afraid to share it with you. NET developers, it is necessary for us to learn some interoperability knowledge. Especially for some senior programmers, mastering unmanaged interoperability can greatly increase our technical competitiveness, i'm going to use the series. This is a casual introduction;

. I will not waste time talking about the basic knowledge of the. NET platform. Go directly to the topic ;. NET is a software development framework on the operating system. It is an abstract encapsulation on the Windows platform and simplifies the complex software development process, this frees us from the technical difficulties of complex repetition for efficient application system development. However, during our work, we often encounter some operations related to calling Win32, for example, the interface related to the user interface calls the User32.dll framework, and some kernels process the Kernel. dll framework. These are the interfaces provided by the platform. To run the software on a computer, no matter how many layers of encapsulation, how many layers of abstraction finally need to convert the code we write into machine code to run the software successfully, but it only reduces the workload of our programmers. [Wang qingpei is copyrighted, reprinted, please give a signature]

1:

650) this. width = 650; "border =" 0 "alt =" "src =" http://img1.51cto.com/attachment/201106/144443368.png "/>

Because.. NET applications are hosted and run in a restricted CLR environment. All memory allocation and collection are managed by CLR. This has both advantages and disadvantages and we cannot use programs to do what we want, only. NET provides us with the function to write, without P/Invoke (platform call), we can do really well, Microsoft also considered if. NET does not provide technical support for the past Windows platform, which will inevitably be greatly hindered. NET technology development, for some mature technologies such as: COM (Component Object Model), OLE (composite document), user interface (User32), memory management (Kernel) and so on. It is quite simple. We can easily call the unmanaged technology. [Wang qingpei is copyrighted. Please give a signature for reprinting.]

To make good use of P/Invoke (platform call) for interoperability, we do not just need to understand. NET platform, we also need to have a simple understanding of the unmanaged technology, for example, the differences between memory usage and unmanaged memory usage of variables in C ++, and character encoding and. differences in character encoding in. NET. The difference between any two different technologies is not only what we look like, but also its operation and memory allocation; when learning about platform calling, we need to spend a little time learning some unmanaged technologies, such as the memory allocation method of COM, CoTaskMemAlloc, and the memory allocation of C ++ is NEW, C memory allocation malloc. Different allocation methods lead to different processing processes for the hosted mail collector. During interoperability, the equivalent processing between the two is more important, for example, whether the memory size layout of the variable is consistent. If the unmanaged code is called in hosting, a pointer type is returned. We use IntPtr to accept the variable, and then use MarShal to mail the helper class of the receiver, this is just the tip of the iceberg in interoperability. When we are skilled in calling the platform, the types of software we develop will be greatly increased, not only Winform and asp.net, but we can also use it. NET to develop some large network systems. More importantly, we can use it. NET to develop some parts.. NET programmers are also discouraged. NET programmers, so we have more chips than our peers;

Summary: This article briefly introduces the knowledge to be involved in interoperability. It may be difficult for me to explain some technical problems related to interoperability in just a few short words. Don't worry. Please continue to pay attention to yourself, next we will introduce the substantive technical operations in interoperability;

This article is from the pattern driven the world blog, please be sure to keep this source http://wangqingpei557.blog.51cto.com/1009349/595015

Related Article

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.