Why do we have Dmain?

Dukc ajieskola at gmail.com
Fri Oct 22 08:38:09 UTC 2021

On Friday, 22 October 2021 at 07:00:25 UTC, Mike Parker wrote:
> The entry point for your program is a function `_start`. That's 
> implemented in the C runtime, which all D programs depend on. 
> It in turn calls `main`, as it does for C and C++ programs.

It is possible, in both C and D, to write your own `_start` and 
not depend on the C runtime.

This is something you want to do only if necessary though - C 
runtime is so small that you don't want to drop it for any 
realistic desktop or even a smartphone program. The usual reason 
to do this is if there is no C runtime easily available - meaning 
mainly embedded targets.

More information about the Digitalmars-d-learn mailing list