Why don't we use the CRT functions under Windows?
IGotD-
nise at nise.com
Sat May 22 19:08:14 UTC 2021
On Saturday, 22 May 2021 at 16:25:08 UTC, Andrei Alexandrescu
wrote:
> While working with the dmd codebase
> (https://github.com/dlang/dmd/pull/12560) I noticed that it
> systematically shuns C runtime calls to functions such as
> unlink, rename etc. Instead the code uses native Windows API
> calls (DeleteFile, MoveFile).
>
> Spoke to Walter about it, he said the reason is mostly
> historical and for the most part forgotten and probably
> obsolete - at least in the past, Windows implementations of CRT
> was poorly done, had subtle differences, and bugs.
>
> Is that still the case? If not, we could reduce the complexity
> of source code considerably by unifying version(Posix) and
> version(Windows) code.
Instead of trying to unify the code, OS dependent implementations
should be moved to separate files. Also, should D rely on the C
library? I would say the D should go the other way and rely on
the C library a little as possible.
Another thing I have noticed that languages that use the
C-library just creates a native copy of the interface (which just
add another layer), instead of defining an own cross platform API
More information about the Digitalmars-d
mailing list