tags:

views:

575

answers:

4
+3  Q: 

What is IDL ?

What is meant by IDL? I have googled it, and found out it stands for Interface Definition Language, which is used for interface definition for components. But, in practice, what is the purpose of IDL? Does Microsoft use it?

+1  A: 

It's a language that has been used in the COM era to define interfaces in a (supposedly) language-neutral fashion.

Dmitri Nesteruk
+13  A: 

An interface definition language (IDL) is used to set up communications between clients and servers in remote procedure calls (RPC). There have been many variations of this such and Sun RPC, ONC RPC, DCE RPC and so on.

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

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

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

In this example, instead of calling function in the same program, main calls a client stub function (with the same prototype as function) which is responsible for packaging up the information and getting it across the wire to another process. This can be the same machine or a different machine, it doesn't really matter - one of the advantages of RPC is to be able to move servers around at will.

In the server, there's a 'listener' process that will receive that information and pass it to the server. The server's stub receives the information, unpacks it and passes it to the real function.

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

The client stub then unpacks that and passes it back to main.

The actual details may differ a little but that explanation should be good enough for a conceptual overview.

The actual IDL may look like:

[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
    );
}

All that stuff at the top is basically networking information, the meat of it is inside the interface section where the prototypes are shown. This allows the IDL compiler to build the x stub and x server functions for compiling and linking with your client and server code to get RPC working.

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

paxdiablo
They do have a MIDL compiler. It's called midlc. Har har.
sblom
midlc as opposed to c#? :-) Only musicians will understand this humor, lame as it is.
paxdiablo
+5  A: 

There is also Interactive Data Language which I had a job using for scientific data analysis, but perhaps from the context it's clear to you that's not what this IDL stands for.

Kai
A: 

It defines the interface to be used for communication with an exposed service in another application.

If you use SOAP you'll know about WSDL. The WSDL is another form of an IDL. IDL usually refers to Microsoft COM or CORBA IDL.

sjbotha