Is D Dead?
Reimer Behrends
behrends at gmail.com
Thu Sep 16 09:26:06 UTC 2021
On Thursday, 16 September 2021 at 05:59:57 UTC, Araq wrote:
> To emulate TLS allocate a block of memory at the top/bottom of
> your stack and use a bitmask on your stack pointer in order to
> access it. No OS support required.
This can be pretty fast and portable, but there are some
additional challenges with separate compilation.
Without separate compilation, you can generate constant offsets
into the TLS area at compile time; with separate compilation, you
either need to somehow bake this into the linking step or figure
out offsets at runtime.
Likewise for the stack size, which must be consistent across all
separately compiled modules.
But even with those constraints, it can still be a pretty good
option.
More information about the Digitalmars-d
mailing list