Last update April 18, 2005

IDL



This page is under heavy construction, as I am writing this as I digest the XML DOM specification. All are encouraged to contribute. - EricAnderton

What is IDL?

The Interface Description Language is used all over the computer science landscape, especially when concepts are described in a language-neutral way. It is also used directly by some languages and compilers as a means of describing an interface with an external system (like in CORBA). One can describe a binary interface for two systems, written in completely different languages, in IDL and expect them to inter-operate.

Converting from IDL to D

So you want to implement an IDL module or interface in D? The process is actually very straightforward, and can be done about 90% via search-and-replace.

At first glance, IDL looks a lot like D. IDL has support for typedefs and interfaces, and even predefined Object and Exception types.

IDL has several attributes that D doesn't have. Coping with these differences usually means altering your interfaces slightly to adopt the behavior specified in the IDL version.

  • readonly attribute - Read-only attributes can be best emulated via D's 'property method' technique.
  • raises(exceptionname) - There is no equivalent for this in D, so just throw it out. You may want to include this bit in your documentation for use later.
The basic data types in IDL share some of the same names in D. The most confusing of these is "long", which is the samea as an "int" in D. The rest are fairly straightforward.*

IDLDwidth
voidvoidNA (return-type only)
boolean??????
???bytesigned 8 bits
????ubyteunsigned 8 bits
shortshortsigned 16 bits
unsigned shortushortunsigned 16 bits
longintsigned 32 bits
unsigned longuintunsigned 32 bits
long longlongsigned 64 bits
unsigned long longulongunsigned 64 bits
???float32 bit floating point
???double64 bit floating point
???charunsigned 8 bit UTF-8
???wcharunsigned 16 bit UTF-16
???dcharunsigned 32 bit UTF-32

There are no IDL equivalents for the bit, complex, imaginary, real or cent datatypes. Pointers are also not supported in IDL.

Links

Wikipedia: IDL - http://en.wikipedia.org/wiki/Interface_description_language Example: W3C? XML DOM IDL - http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl/dom.idl

Footnotes

(*) some programmers may recognize this matrix from C/C++ to D type conversions, which are largely the same


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: April 18, 2005 23:11 (diff))