[Home]
[Search]
[D]
Last update Jul 16, 2004
D Application Binary Interface
A D implementation that conforms to the D ABI (Application Binary Interface)
will be able to generate libraries, DLL's, etc., that can interoperate with
D binaries built by other implementations.
Most of this specification remains TBD (To Be Defined).
C ABI
The C ABI referred to in this specification means the C Application
Binary Interface of the target system.
C and D code should be freely linkable together, in particular, D
code shall have access to the entire C ABI runtime library.
Basic Types
TBD
Structs
Conforms to the target's C ABI struct layout.
Classes
An object consists of:
offset contents
------ --------
0: pointer to vtable
4: monitor
8... non-static members
The vtable consists of:
0: pointer to instance of ClassInfo
4... pointers to virtual member functions
The class definition:
class XXXX
{
....
};
Generates the following:
- An instance of Class called ClassXXXX.
- A type called StaticClassXXXX which defines all the static members.
- An instance of StaticClassXXXX called StaticXXXX for the static members.
Interfaces
TBD
Arrays
A dynamic array consists of:
0: array dimension
4: pointer to array data
A dynamic array is declared as:
type array[];
whereas a static array is declared as:
type array[dimension];
Thus, a static array always has the dimension statically available as part of the type, and
so it is implemented like in C. Static array's and Dynamic arrays can be easily converted back
and forth to each other.
Associative Arrays
TBD
Reference Types
D has reference types, but they are implicit. For example, classes are always
referred to by reference; this means that class instances can never reside on the stack
or be passed as function parameters.
When passing a static array to a function, the result, although declared as a static array, will
actually be a reference to a static array. For example:
int abc[3];
Passing abc to functions results in these implicit conversions:
void func(int array[3]); // actually
void func(int *p); // abc[3] is converted to a pointer to the first element
void func(int array[]); // abc[3] is converted to a dynamic array
Name Mangling
TBD
Function Calling Conventions
TBD
Exception Handling
Windows
Conforms to the Microsoft Windows Structured Exception Handling
conventions.
TBD
Linux
Uses static address range/handler tables.
TBD
Garbage Collection
TBD
Runtime Helper Functions
TBD
Module Initialization and Termination
TBD
Unit Testing
TBD
Feedback and Comments
Add feedback and comments regarding this
page.
Copyright (c) 1999-2004 by Digital Mars, All Rights Reserved