Windows DLLs and TLS

Jakob Ovrum jakobovrum at gmail.com
Tue Oct 9 01:29:56 PDT 2012


On Tuesday, 9 October 2012 at 08:41:46 UTC, Jakob Ovrum wrote:
> On Monday, 8 October 2012 at 19:19:58 UTC, Denis Shelomovskij 
> wrote:
>> As I said, give us a runnable failing test suite.
>
> Here's a reduced plugin with VisualD project files and all 
> dependencies.
>
> http://filesmelt.com/dl/bugdist.rar
>
> It uses the standard DllMain, and the only thing 
> xchat_plugin_init contains is this line:
>
> xchat_printf(ph, "test = %p:%d", test.ptr, test.length);
>
> Where 'test' is a TLS variable of type string[] with no 
> explicit initializer.

The printed garbage value is the same when DllMain is empty.

(BTW, to test this, build the DLL and drop it in <HexChat config 
folder>/addons. The line will then print on startup in the first 
available chat window)


More information about the Digitalmars-d mailing list