To program in D you will need two things - a D compiler and a library. Easiest way to get started fast is to install {{Grp|dlang-dmd}} package group. It will provide the official compiler ({{Pkg|dmd}}), standard lbrary {{Pkg|libphobos-devel}}{{Broken package link|replaced by {{Pkg|libphobos}}}} and collection of small development tools {{Pkg|dtools}}.

+

To program in D you will need two things - a D compiler and a library. Easiest way to get started fast is to install {{Grp|dlang-dmd}} package group. It will provide the official compiler ({{Pkg|dmd}}), the standard lbrary {{Pkg|libphobos}} and {{Pkg|dtools}}, a collection of small development tools.

== Testing the installation ==

== Testing the installation ==

Line 34:

Line 34:

There are however possible choices regarding the compiler you choose. The standard (reference one) is dmd, but {{AUR|gdc}} (GNU D Compiler) and {{Pkg|ldc}} (LLVM D Compiler) are also popular. Those are also in [community].

There are however possible choices regarding the compiler you choose. The standard (reference one) is dmd, but {{AUR|gdc}} (GNU D Compiler) and {{Pkg|ldc}} (LLVM D Compiler) are also popular. Those are also in [community].

−

The main difference is that the dmd's back end is not FOSS (licensed from Symantec), while the others compilers are completely FOSS. All 3 compilers share same front-end code and thus have almost identical support for language features (assuming same front-end version).

+

As of April 2017 [https://github.com/dlang/dmd/pull/6680 dmd's backend is now FOSS] (Boost-licensed). All 3 compilers share same front-end code and thus have almost identical support for language features (assuming same front-end version).

−

−

== hardening-wrapper ==

−

−

In Arch Linux {{Pkg|dmd}} and {{Pkg|libphobos}} packages are built without PIC support.

−

Using {{Pkg|hardening-wrapper}}{{Broken package link|package not found}} forces building executables with PIC support which results in:

−

−

dmd app.d

−

/usr/bin/ld: app.o: relocation R_X86_64_32 against `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC

Latest revision as of 13:00, 18 September 2017

"The D programming language, also known simply as D, is an object-oriented, imperative, multi-paradigm system programming language by Walter Bright of Digital Mars. It originated as a re-engineering of C++, but even though it is predominantly influenced by that language, it is not a variant of it. D has redesigned some C++ features and has been influenced by concepts used in other programming languages, such as Java, C#, and Eiffel".

Contents

Installation

To program in D you will need two things - a D compiler and a library. Easiest way to get started fast is to install dlang-dmd package group. It will provide the official compiler (dmd), the standard lbrary libphobos and dtools, a collection of small development tools.

Testing the installation

To make sure that everything is installed and set up correctly, a simple Hello World program should suffice.

in the same directory as the file. You should then be able to execute the program with:

$ ./hello

You can also execute

$ dmd -run hello.d

which will simply compile and run without leaving any object files in the directory.

Considerations

There are however possible choices regarding the compiler you choose. The standard (reference one) is dmd, but gdcAUR (GNU D Compiler) and ldc (LLVM D Compiler) are also popular. Those are also in [community].

As of April 2017 dmd's backend is now FOSS (Boost-licensed). All 3 compilers share same front-end code and thus have almost identical support for language features (assuming same front-end version).