Supporting musl libc

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Tue May 17 04:30:33 PDT 2016


On 2016-05-17 11:27, Joakim wrote:

> It is a runtime option on Windows, when choosing between the Digital
> Mars C runtime and the MSVC runtime, which is why those are also
> predefined version identifiers.  The one for Glibc was added as an
> afterthought in that Windows PR, and Bionic was also reserved last fall,
> though my PR to actually define it has been in limbo for a year.  That's
> mostly my fault: I never got back to it when I focused on ldc and
> Android/ARM.
>
> There was a lot of debate among the core team when even the Windows
> CRuntime support was finalized, with Walter wanting to minimize such
> predefined versions and some of the core team arguing against it even
> after it was merged.  Even the iOS predefined version took 5 months to
> get in, because there was debate whether Darwin should be allowed as a
> common version for all Apple platforms.
>
> The reason I'm mentioning all this is that adding predefined versions is
> a matter of much debate, but that's how you'll likely implement it as a
> runtime option.  There is no good answer on this right now: I suggest
> you just implement it and worry about run-time versus compile-time when
> you're done.  Since you'll be doing the same work either way, ie adding
> or separating out a bunch of version blocks for musl in druntime, do it
> any way you like for now and you can worry about merging that last bit
> about compile-time vs runtime at the end.

It depends. One approach would be to add an option to the druntime 
makefile, which would add -version CRuntime_Musl when compiling. In that 
case version(CRuntime_Musl) needs to come before version(CRuntime_Glibc) 
when declaring the imports. It doesn't sound like a good idea, to depend 
on the order of the version statements, but it's still a possibility.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list