Ideas for runtime loading of shared libraries.

Jacob Carlborg doob at me.com
Tue Jan 3 10:00:23 PST 2012


On 2012-01-03 18:51, Martin Nowak wrote:
> 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

Oh, you mean dynamic like that. I thought you meant accessing "a" from a 
dynamic library.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list