Ideas for runtime loading of shared libraries.

Martin Nowak dawg at dawgfoto.de
Tue Jan 3 09:51:13 PST 2012


On Tue, 03 Jan 2012 18:44:27 +0100, Jacob Carlborg <doob at me.com> wrote:

> On 2012-01-03 17:53, Martin Nowak wrote:
>> Yes most, but not all.
>> The core issue here is that C++'s __thread doesn't allow dynamic
>> initializers,
>> thus there is no infrastructure to do such things. And really a clean
>> approach
>> would be to extend libc/ld.so.
>
> First, __thread isn't supported in Mac OS X (if we're talking about  
> that). For all the operating systems that do support TLS I'm pretty sure  
> that TLS and dynamic libraries work.
>
> This documentation:
>
> http://www.akkadia.org/drepper/tls.pdf
>
> mentions several different TLS modes, some used for dynamic libraries  
> and some used for other cases.
>

C++ takes a very simple approach here.
You can have
     __thread int a = 3;
but not
     __thread int a = geta();
     error: 'a' is thread-local and so cannot be dynamically initialized


More information about the Digitalmars-d mailing list