www.digitalmars.com [Home] [Search] [D]

Interfacing to C

D is designed to fit comfortably with a C compiler for the target system. D makes up for not having its own VM by relying on the target environment's C runtime library. It would be senseless to attempt to port to D or write D wrappers for the vast array of C APIs available. How much easier it is to just call them directly.

This is done by matching the C compiler's data types, layouts, and function call/return sequences.

Calling C Functions

Calling printf()

Storage Allocation

Data Type Compatibility

Structs and Unions


Copyright (c) 1999-2001 by Digital Mars, All Rights Reserved