[dmd-internals] Building Phobos and druntime as a dylib on Mac OS X

Sean Kelly sean at invisibleduck.org
Fri Dec 2 11:45:48 PST 2011


On Nov 30, 2011, at 12:57 PM, Jacob Carlborg wrote:

> 
> On 21 nov 2011, at 20:12, Walter Bright wrote:
>> 
>> On 11/21/2011 9:17 AM, Jacob Carlborg wrote:
>>> 
>>>> One reason dmd doesn't support dynlib yet is because I haven't done much research into how dynlib actually works.
>>> 
>>> Ok, I see. I though that you might know since you have developed a C++ compiler as well. I assume dynamic libraries can be used with DMC. Note that when I say "dylib" I mean the general term "dynamic library" and not the Mac OS X specific implementation.
>>> 
>> 
>> DLLs on Windows work very differently from dynlibs on other systems. You have to approach each as its own animal.
> 
> I've done some research about how TLS is implemented in the ELF format. I don't understand everything but I think I've got a, at least, somewhat better understanding of TLS.
> 
> I've started to think about if it's possible to implement TLS on Mac OS X in the same way as it's implement on Linux, but just with the help of the compiler and runtime.

> ...
> 
> BTW, according to this:
> 
> http://stackoverflow.com/questions/2436772/thread-local-storage-macosx
> 
> GCC 4.5+ on Mac OS X supports the __thread keyword but it's emulated.
> 
> TLS reference: http://www.akkadia.org/drepper/tls.pdf

I don't know if it matters, but __thread should be natively supported in Lion (by llvm-gcc, not DMD).  OSX is doing away with GCC so it wouldn't surprise me if no effort had been made to add __thread support to that.


More information about the dmd-internals mailing list