Shared Libraries [was Re: D 1.076 and 2.061 release]

Robert Clipsham robert at octarineparrot.com
Mon Jan 7 02:14:53 PST 2013


On Sunday, 6 January 2013 at 23:19:48 UTC, Walter Bright wrote:
> DMD implements its own TLS on OS X because the OS X C compiler 
> says "not implemented" when you try to create TLS variables. I 
> had no other option.

Note that this no longer appears to be the case, at least with 
clang (OS X 10.7.5):
----
#include <stdio.h>
__thread int foo;
int main(){
     foo = 4;
     printf("%d\n", foo);
}
----
$ clang test.c
$ ./a.out
4
$ clang --version
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on 
LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

(llvm-)gcc still complains:
$ gcc test.c
test.c:2: error: thread-local storage not supported for this 
target
$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. 
build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  
There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A 
PARTICULAR PURPOSE.


Though I believe it will probably fail with older OS X versions 
which don't have TLS support.

Robert


More information about the Digitalmars-d-announce mailing list