[D-runtime] Supporting different C libraries and architectures
David Nadlinger
code at klickverbot.at
Sun Feb 26 06:13:30 PST 2012
Just a few quick ideas, I must admit that I didn't really think the
issue through yet:
On 26 Feb 2012, at 14:32, Johannes Pfau wrote:
> Kagamin suggested to add complete glibc, bionic, etc bindings to
> deimos, then core.* could publically import the approriate modules
> from deimos. […]
This poses a question though: If we already have the files in Deimos,
why offer the interfaces through druntime at all (besides backwards
compatibility)? Which parts of Posix, … should be offered through
core.*?
> Seems like a good idea to me. We'd need some way to determine the used
> C library with static if(), to import the correct files, […]
Just a -version switch defined in dmd.conf/sc.ini (resp. ldc.conf, or
the GDC equivalent) seems like a fine solution for me. It would probably
mapped to an enum by a druntime module for easier handling, and if not
present, we could simply print out a pragma(msg) and default to glibc
where appropriate to offer a smooth transition for people who don't
routinely upgrade their DMD config files.
> Technically this means druntime depends on deimos, but those are only
> bindings which could be compiled/shipped with druntime.
Note aside: Deimos bindings never ever need to be compiled. If they do
require linking in symbols besides the C library itself, it's a bug (at
least in my opinion).
David
More information about the D-runtime
mailing list