What is an IDL?

What is meant by IDL? I looked for it and found out that this means a language definition interface that is used to define an interface for components. But in practice, what is the purpose of IDL? Does Microsoft use it?

+41
idl
Mar 22 '09 at 6:55
source share
6 answers

Interface Definition Language (IDL) is used to configure communication between clients and servers in remote procedure calls (RPC). There have been many changes like Sun RPC, ONC RPC, DCE RPC, etc.

Basically, you use the IDL to specify the interface between the client and the server, so that the RPC mechanism can create the code stubs needed to call functions over the network.

RPC needs to create stub functions for the client and server using IDL information. It is very similar to a function prototype in C, but the end result is slightly different, for example:

+----------------+ | Client | | +----------+ | +---------------+ | | main | | | Server | | |----------| | | +----------+ | | | stub_cli |------->| stub_svr | | | +----------+ | | |----------| | +----------------+ | | function | | | +----------+ | +---------------+ 

In this example, instead of calling function in the same program, main calls the client stub function (with the same prototype as function ), which is responsible for packing the information and transferring it over the wire to another process. It can be the same machine or another machine, it does not really matter - one of the advantages of RPC is the ability to move servers as you wish.

There is a โ€œlistenerโ€ process on the server that will receive this information and transfer it to the server. A server stub receives information, unpacks it, and passes it to a real function.

The real function then performs what it needs and returns it to the server stub, which can pack the returned information (both the return code and any [out] or [in,out] variables) and transfer it back to the client stub.

Then the client stub unpacks and returns it back to main .

Actuals may vary slightly, but this explanation should be good enough for a conceptual review.

The actual IDL might look like this:

 [uuid(f9f6be21-fd32-5577-8f2d-0800132bd567), version(0), endpoint("ncadg_ip_udp:[1234]", "dds:[19]")] interface function_iface { [idempotent] void function( [in] int handle, [out] int *status ); } 

Everything at the very top is basically network information, the meat of which is inside the interface section where the prototypes are shown. This allows the IDL compiler to create the x stub and x server functions to compile and link to your client and server code to make RPC work.

Microsoft uses IDL (I think they have a MIDL compiler) for COM stuff. I also used third-party products with MS operating systems, both DCE and ONC RPC.

+54
Mar 22 '09 at 7:58
source share

There is also an Interactive Data Language that I used to analyze scientific data, but perhaps from a context that you understand that doesn't mean what IDL means.

+10
Mar 23 '09 at 3:58
source share

IDL stands for Interface Definition Language , which has several options, depending on the provider or the standard group that defined the language. The purpose of the IDL is to describe the interface for a certain service so that customers who want to use the service know what methods and properties the interface provides the service. An IDL is commonly used with binary interfaces, and an IDL language file describes the data types used in a binary interface.

There are several different standards for binary components, usually COTS or Commercial Off The Shelf , and how a client communicates with a binary component may vary although some version of Remote Procedure Call or RPC is traditionally used. Two such standards are the common Microsoft object model or COM standard and the common Request Broker or CORBA standard object . There are other standards for components, such as Firefox plugins or plugins for other applications, such as Visual Studio itself, but they do not necessarily use any form of interface description. The language instead uses some kind of software development kit or SDK with standardized and well-known APIs.

What IDL allows is a great degree of flexibility in creating components that offer various types of services that, due to their binary nature, can be used with different programming languages โ€‹โ€‹and different environments.

Microsoft uses the IDL dialect with COM objects, and the Microsoft IDL is not the same as the CORBA IDL, although there are similarities because they share common language roots. The IDL file describes the interfaces supported by the COM object. COM allows you to create In Process services (can use RPC or direct DLL calls) or Out of Process services (uses RPC). The idea of โ€‹โ€‹COM is that the client only needs to know the identifier of the component along with the interface in order to be able to use it. The client requests a COM object, then requests a class object from the factory COM object, which supports the interface that the client wants to use, and then uses the COM object through this interface.

Microsoft provides a MIDL compiler that processes the IDL file to create a type library, provide information to the COM object users about the interface and the necessary stubs to marshal data through the interface between the client and the service.

Data marching basically means that the stub takes the data provided by the client, packs it, and sends it to the service, which takes some action and sends the data back. This sending and receiving of data can be done through some RPC service or through direct calls to DLL functions. The response from the service is translated into a form suitable for the client, and then provided to the client. Thus, the main function of marshaling is the adapter (see the adapter design template) or the bridge (see the bridge design template) between the client and the service.

Visual Studio, my experience with C ++, contains several wizards that you can use to create an example so you can play with it. If this interests you, you can create a workspace, and then in the workspace you can create an ATL project to create a control, and then a simple MFC dialog project to test it. Using ATL for your COM control hides quite a few details that you can explore later, and the simple MFC dialog design provides an easy way to create a container. You can also use the Active Test Control Container tool available in Visual Studio to conduct preliminary testing and see how the methods and properties work.

There are also a number of sample projects on websites such as codeproject.com. For example, here is one using C to expose all the ugly plumbing behind COM and here using C ++ without ATL .

+5
Nov 23 '14 at 18:10
source share

This is the language used in the COM era to define interfaces in (presumably) neutral-neutral mode.

+1
Mar 22 '09 at 7:56
source share

It defines the interface that will be used to communicate with the open service in another application.

If you use SOAP, you will learn about WSDL. WSDL is another form of IDL. IDL usually refers to Microsoft COM or CORBA IDL.

+1
Mar 23 '09 at 3:58
source share

IDL is vital in 2 cases. 1. Create a proxy / stub dll server for exe-servers. 2. Creating a type library for automation servers.

There is a very good article on the basics of IDL in link

To learn about IDLs, itโ€™s best to read the compilers of your own idl header files that are listed include the VC ++ package subdirectory.

+1
Mar 04 '16 at 17:23
source share



All Articles