4.4.2 Code generation

Writing the low-level C code that realizes classes and interfaces that adhere to this object model is arguably tedious and error-prone. The many languages that improve on C by adding language-level support for object-orientation, such as C++ and Objective-C, are a testament to the usefulness of having support for object-orientation at the language level.

Much of this low-level C code could be generated, though, provided that the relevant classes and interfaces are described in an interface description language. An IDL compiler could completely generate the interface files, including the access macros and the client variable and dispatch table types. Class implementations could be generated as two files, one housing dispatch tables and runtime names, and one containing the operation implementations. Only the latter file would need to be manually edited to provide the domain-specific functionality. Implementations of all Fundamental operations could also be generated, as well as an implementation of Scriptable::InvokeOperation(), if support for very late binding is desired. Factories could also be automatically generated, as could proxies used for inter-process and inter-machine communication, if support for location-transparent invocations is added to this component model.