What are IDL and midl?

Source: Internet
Author: User
Article Original Source http://www.ai361.com
The title of the original article is probably "Notes"-"COM technology insider".
Author Raytheon
This is one of the two FAQs that Raytheon has just completed the book "COM technology insider:

Question:
What are IDL and midl?
Answer:
IDL is the interface definition language.
Midl is Microsoft's IDL compiler.
After Using IDL to describe interfaces and components, you can use midl to compile and generate the C code of the corresponding proxy and stub DLL.
Example:
Import "unknown. IDL" // used to include definitions in other IDL files into the current file
/// Interface IX
[// Note that [] is not {}
Object, // The defined interface is a COM interface
UUID (32bb8323-b41b-11cf-a6bb-0080c7b2d682), // corresponding interface IID
Helpstring ("ix interface"), // puts the help string into the Type Library
Pointer_default (unique) // This type of pointer can be null, and their values can be modified in the function, but aliases cannot be specified.
]
Interface IX: iunknown
{
/// The in keyword tells midl that the parameter value needs to be passed from the customer to the component, and the stub Code does not need to return any value.
Hresult fxstringin ([IN, string] wchar_t * szin );
/// The out keyword indicates that the midl parameter is only used to send data from the component to the customer,
/// The proxy does not need to set columns for output parameters or PASS Parameters to components.
Hresult fxstringout ([out, string] wchar_t * szout );
/// COM: The standard convention for strings is Unicode (that is, wchar_t)
}
The IDL file can define C and C ++-style structures and use them as function parameters.
When an IDL file contains a library, midl generates a Type Library.
Midl generates C code for the corresponding proxy and stub for the interface.
To obtain a proxy/stub DLL, You need to compile and link the c file generated by midl.
Macro register_proxy_dll registers the proxy/stub DLL in the registry.
With IDL and midl, we can call functions that span process boundaries like calling in-process components and set columns for parameters.

Question:
What is proxy and stub DLL?
Answer:
The customer communicates with a DLL that imitates the component. This dll can complete the parameter column set, which is called a proxy.
A proxy is a component with the same behavior as another component.
The proxy must be in the DLL format.
The component also needs a stub DLL to separate data from the customer.
The stub also sets the data that is returned to the customer.

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.