Chapter 9. Connecting D with C

There are many reasons a programming language may fail to gain traction, but a surefire way to discourage adoption is to make it incompatible with C, whose ABI is the lingua franca of programming languages. Even if the creators of a new software project are in a position to choose any language they'd like to work with, it's unlikely that they would be willing to take the time to port or recreate the popular battle-tested C libraries they are sure to need, such as image loaders, graphics interfaces, or database drivers. The easier it is to interface with C, the better.

Binary compatibility with C was a priority with D from the beginning. This means it's possible for code written in D to directly call functions written ...

Get Learning D now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.