D: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
(+Cat: Languages)
m (Change OSKit external link to wiki internal link)
 
(5 intermediate revisions by 5 users not shown)
Line 5: Line 5:
The D language is a language suitable for OS development, as some people on the forums have already stated. It might, however, require some extra changes. There is also a tutorial available on [[GDC Cross-Compiler|how to build a D cross compiler]] (using GDC).
The D language is a language suitable for OS development, as some people on the forums have already stated. It might, however, require some extra changes. There is also a tutorial available on [[GDC Cross-Compiler|how to build a D cross compiler]] (using GDC).


== Links ==
== Limitations ==
D is designed to be a systems language and is perfectly capable of running directly on the hardware with nothing more than an stub in assembly to jump to your main function. However, a lot of the language's features besides the most basic are tightly integrated into the standard library. Attempting to do string operations, slice arrays, hash arrays, use smart pointers, type checking on types not known at compile time, and a myriad of other features will lead to a number of missing symbols at link time that aren't well documented at all. Attempting to use reference the [http://www.digitalmars.com/d/2.0/phobos/phobos.html Phobos] source and port the required functions will soon make you realize how interdependent functions are one another and before you know it you've ported the majority of Phobos in to your kernel (which by the way, references the C standard library a lot).

So in reflection, unless you want to port a D standard library into your kernel from the beginning, the only advantage of D over C or C++ for kernel programming is the advance templating and conditional compile features.

Of course, you could think about writing a 'stub' kernel in D, and then linking it with existing C libraries, like the [[OSKit]].

==See Also==
===External Links===
* [[GDC Cross-Compiler|How to build a D cross-compiler]]
* [[GDC Cross-Compiler|How to build a D cross-compiler]]
* [[D bare bones|D kernel bare bones]]
* [[D bare bones|D kernel bare bones]]
Line 11: Line 19:


[[Category:Languages]]
[[Category:Languages]]
[[Category:D]]
[[de:D]]

Latest revision as of 10:08, 3 October 2023

This page is a stub.
You can help the wiki by accurately adding more contents to it.

D is a programming language, originally created by Walter Bright (from Digital Mars). Originally, the idea was to fix up some parts of C++, but in the meantime, some parts have completely changed. Even though the syntax of the D programming language is similar to that of C++, it is not a variant.

The D language is a language suitable for OS development, as some people on the forums have already stated. It might, however, require some extra changes. There is also a tutorial available on how to build a D cross compiler (using GDC).

Limitations

D is designed to be a systems language and is perfectly capable of running directly on the hardware with nothing more than an stub in assembly to jump to your main function. However, a lot of the language's features besides the most basic are tightly integrated into the standard library. Attempting to do string operations, slice arrays, hash arrays, use smart pointers, type checking on types not known at compile time, and a myriad of other features will lead to a number of missing symbols at link time that aren't well documented at all. Attempting to use reference the Phobos source and port the required functions will soon make you realize how interdependent functions are one another and before you know it you've ported the majority of Phobos in to your kernel (which by the way, references the C standard library a lot).

So in reflection, unless you want to port a D standard library into your kernel from the beginning, the only advantage of D over C or C++ for kernel programming is the advance templating and conditional compile features.

Of course, you could think about writing a 'stub' kernel in D, and then linking it with existing C libraries, like the OSKit.

See Also

External Links