[Issue 15523] extern(C++) support TLS (C++ 'thread_local') linkage?

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jan 8 08:05:28 PST 2016


https://issues.dlang.org/show_bug.cgi?id=15523

--- Comment #9 from Jacob Carlborg <doob at me.com> ---
(In reply to Manu from comment #7)

> How? We have no support at all right now... there's nothing to break?

Hmm, yeah. I kind of assumed it already worked, at least for built-in types,
like int.

> For real? How old is that compiler?

Xcode 7.2 was released Dec 8, 2015.

> That still doesn't change that it's non-standard, and I would reserve
> default behaviour for the standard keyword, which I'm astonished isn't in
> the Clang release.

__thread is supported, but not thread_local. See this stackoverflow post [1]
explaining why. Something about ABI compatibility.

> ** google reveals a lot of people also complaining that __thread doesn't
> work on Apple compilers either.

It's supported since OS X 10.7, quite old by now.


> I don't really think so; __thread is a C++ attribute, so I think it only
> makes sense if you extern(C++) aswell.

You mean "thread_local"?

> Yeah, I saw the same article.
> My guess was that the extern case generates a function call such that they
> can change the ABI if they like. Doesn't seem like a problem to me, and
> actually, should make it really easy to implement! Just lower to a little
> stub with the proper mangled name.

Yeah, as long as you know how the compiler works ;)

[1] http://stackoverflow.com/a/29929949

--


More information about the Digitalmars-d-bugs mailing list