Thread overview
TLS
Mar 10, 2017
M-exe
Mar 10, 2017
rikki cattermole
Mar 10, 2017
M-exe
Mar 10, 2017
rikki cattermole
Mar 10, 2017
M-exe
Mar 10, 2017
bauss
Mar 10, 2017
sarn
Mar 13, 2017
M-exe
Mar 13, 2017
Rainer Schuetze
Mar 13, 2017
Joakim
March 10, 2017
I found that D is great language, but for my own reasons I'm trying to use it without TLS at all.

Can the TLS directory be avoided? (compiling on windows)
I mean, can it avoided without losing GC and main language features?

I found out that also when with -vtls there is no output, there is TLS Directory in the final binary.
March 10, 2017
On 10/03/2017 7:41 PM, M-exe wrote:
> I found that D is great language, but for my own reasons I'm trying to
> use it without TLS at all.
>
> Can the TLS directory be avoided? (compiling on windows)
> I mean, can it avoided without losing GC and main language features?
>
> I found out that also when with -vtls there is no output, there is TLS
> Directory in the final binary.

Wait, why on earth do you not want TLS?
March 10, 2017
On Friday, 10 March 2017 at 06:46:03 UTC, rikki cattermole wrote:
> On 10/03/2017 7:41 PM, M-exe wrote:
>> I found that D is great language, but for my own reasons I'm trying to
>> use it without TLS at all.
>>
>> Can the TLS directory be avoided? (compiling on windows)
>> I mean, can it avoided without losing GC and main language features?
>>
>> I found out that also when with -vtls there is no output, there is TLS
>> Directory in the final binary.
>
> Wait, why on earth do you not want TLS?

Compatibility issues (like under XP)

Solutions like this is not enough stable:
https://github.com/dlang/druntime/blob/master/src/core/sys/windows/dll.d

I'm searching for solution like the /Zc:threadSafeInit- flag under VS2015
March 10, 2017
On 10/03/2017 8:06 PM, M-exe wrote:
> On Friday, 10 March 2017 at 06:46:03 UTC, rikki cattermole wrote:
>> On 10/03/2017 7:41 PM, M-exe wrote:
>>> I found that D is great language, but for my own reasons I'm trying to
>>> use it without TLS at all.
>>>
>>> Can the TLS directory be avoided? (compiling on windows)
>>> I mean, can it avoided without losing GC and main language features?
>>>
>>> I found out that also when with -vtls there is no output, there is TLS
>>> Directory in the final binary.
>>
>> Wait, why on earth do you not want TLS?
>
> Compatibility issues (like under XP)
>
> Solutions like this is not enough stable:
> https://github.com/dlang/druntime/blob/master/src/core/sys/windows/dll.d
>
> I'm searching for solution like the /Zc:threadSafeInit- flag under VS2015

D does not support Windows XP.
If you absolutely require it, you will have to contact Walter about support.
March 10, 2017
On Friday, 10 March 2017 at 07:17:22 UTC, rikki cattermole wrote:
> D does not support Windows XP.
> If you absolutely require it, you will have to contact Walter about support.

Let me care about it ;)
I just need help with the TLS :)
March 10, 2017
On Friday, 10 March 2017 at 07:33:44 UTC, M-exe wrote:
> On Friday, 10 March 2017 at 07:17:22 UTC, rikki cattermole wrote:
>> D does not support Windows XP.
>> If you absolutely require it, you will have to contact Walter about support.
>
> Let me care about it ;)
> I just need help with the TLS :)

Mark your variables with __gshared. I would say shred, but it has some restrictions to it, where __gshared is the equivalent to global variables in C.
March 10, 2017
On Friday, 10 March 2017 at 19:24:29 UTC, bauss wrote:
> Mark your variables with __gshared. I would say shred, but it has some restrictions to it, where __gshared is the equivalent to global variables in C.

immutable variables are also not put in TLS.
March 13, 2017
On Friday, 10 March 2017 at 21:32:05 UTC, sarn wrote:
> On Friday, 10 March 2017 at 19:24:29 UTC, bauss wrote:
>> Mark your variables with __gshared. I would say shred, but it has some restrictions to it, where __gshared is the equivalent to global variables in C.
>
> immutable variables are also not put in TLS.

Thank you for yours replys but there is a tls directory even when I compile empty main..
March 13, 2017
On Friday, 10 March 2017 at 06:41:46 UTC, M-exe wrote:
> I found that D is great language, but for my own reasons I'm trying to use it without TLS at all.
>
> Can the TLS directory be avoided? (compiling on windows)

I don't know what you mean by the TLS directory, can you explain?

> I mean, can it avoided without losing GC and main language features?

You could probably modify druntime so that it doesn't use any Thread-Local Storage, but Phobos uses it extensively, as global and static variables are put in TLS by default since D 2.030:

https://dlang.org/migrate-to-shared.html

Are you against emulated TLS also?  If not, I have modified dmd, ldc, and druntime to use the same emulated TLS scheme Walter came up with for OS X, for my Android port:

https://github.com/dlang/dmd/pull/3643
https://github.com/ldc-developers/ldc/pull/1447
https://github.com/dlang/druntime/pull/784

You may be able to use something similar on Windows, depending on how feasible such an emulated TLS scheme is there and if you want to dig into these details.
March 13, 2017

On 13.03.2017 14:35, M-exe wrote:
> On Friday, 10 March 2017 at 21:32:05 UTC, sarn wrote:
>> On Friday, 10 March 2017 at 19:24:29 UTC, bauss wrote:
>>> Mark your variables with __gshared. I would say shred, but it has
>>> some restrictions to it, where __gshared is the equivalent to global
>>> variables in C.
>>
>> immutable variables are also not put in TLS.
>
> Thank you for yours replys but there is a tls directory even when I
> compile empty main..

It's very likely that there are TLS variables in druntime that are linked in. You can identify them by looking at the map file.