· Lexical · Modules · Declarations · Types · Properties · Attributes · Pragmas · Expressions · Statements · Arrays · Structs & Unions · Classes · Interfaces · Enums · Functions · Operator Overloading · Templates · Mixins · Contracts · Conditional Compilation · Handling errors · Garbage Collection · Memory Management · Floating Point · Inline Assembler · Documentation Comments · Interfacing To C · Portability Guide · Embedding D in HTML · Named Character Entities · Application Binary Interface |
D Application Binary InterfaceA 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 ABIThe 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 TypesTBDStructsConforms to the target's C ABI struct layout.ClassesAn object consists of:
The vtable consists of:
The class definition: class XXXX
{
....
};
Generates the following:
InterfacesTBDArraysA dynamic array consists of:
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 ArraysTBDReference TypesD 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 <reference to><array[3] of><int> 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 ManglingD accomplishes typesafe linking by mangling a D identifier to include scope and type information.MangledName: _D QualifiedName Type QualifiedName: SymbolName SymbolName QualifiedName SymbolName: LName TemplateInstanceNameTemplate Instance Names have the types and values of its parameters encoded into it: TemplateInstanceName: __T LName TemplateArgs Z TemplateArgs: TemplateArg TemplateArg TemplateArgs TemplateArg: T Type V Type Value S LName Value: n Number N Number e 20HexDigits c 20HexDigits 20HexDigits Width Number _ HexDigits Width: a w d HexDigits: HexDigit HexDigit HexDigits HexDigit: Digit a b c d e fn is for null arguments. Number is for positive numeric literals. N Number is for negative numeric literals. e 20HexDigits is for real and imaginary floating point literals. c 20HexDigits 20HexDigits is for complex floating point literals. Width Number _ HexDigits: Width is whether the characters are 1 byte (a), 2 bytes (w) or 4 bytes (d) in size. Number is the number of characters in the string. The HexDigits are the hex data for the string. Name: Namestart Namestart Namechars Namestart: _ Alpha Namechar: Namestart Digit Namechars: Namechar Namechar Namechars Type: TBDA Name is a standard D identifier. LName: Number Name Number: Digit Digit Number Digit: 0 1 2 3 4 5 6 7 8 9An LName is a name preceded by a Number giving the number of characters in the Name. Function Calling ConventionsTBDException HandlingWindowsConforms to the Microsoft Windows Structured Exception Handling conventions. TBDLinuxUses static address range/handler tables. TBDGarbage CollectionTBDRuntime Helper FunctionsTBDModule Initialization and TerminationTBDUnit TestingTBD |