idlc 1.5.14
Interface Definition Language Compiler
|
This project is not intended for production use. The tool is primarily being developed for my personal needs — to generate C APIs for C libraries from IDL specifications, as well as to automatically wrap the resulting C libraries for other languages, enabling them to be used as native libraries.
Below is an online demo of the compiler:
For example, the IDLC tool itself uses its own functionality to generate its API:
idlc_compile
function);idlc_compile
function monitors changes in the specs (.idl files) and, if necessary, rebuilds the headers in the ./include/idlc
directory. These headers provide declarations for the C API, which is implemented by the C++ library. Of course, these headers are committed and distributed alongside the library.
Even for this online demo, the tool uses itself to generate the JavaScript library, packaging the WASM module for native use in JavaScript code. Exposing an API that has classes with methods, properties, and other familiar constructs.
The compiler is distributed as a library with a C API for embedding, as well as a command-line tool for standalone compilation. In other words, it can be used both as an embedded compiler and as a separate tool.
As for the IDL language itself — it is an abstract language not tied to any specific programming language but designed to accommodate a wide range of languages. For example, it supports properties and case-sensitive symbols, but it does not allow two different symbols that differ only in case (due to case-insensitive languages), and so on.
The workflow of this tool can be roughly represented by the following diagram:
While this project is not intended as an industrial-grade solution, it serves as a practical example of:
Why a new IDL language? Traditional Interface Definition Languages (IDLs) consistently fall short in achieving true cross-language interoperability. Most of these languages try to impose a "lowest common denominator" approach, which makes them awkward and unnative to use everywhere. This leads to context blindness — not adapting to linguistic idioms:
For example, differences in working with arrays:
This language overcomes this by generating APIs and automatic wrappers for C, so that the API can be used natively in any supported language.
Usage in C:
Usage in JavaScript:
For a step-by-step guide on embedding the compiler into your project (to enable API support and generate native wrappers for other languages), check out the Quick Start.