osx shared libraries.

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 17 16:46:09 PDT 2015


On Tue, 16 Jun 2015 20:07:03 -0400, David Nadlinger <code at klickverbot.at>  
wrote:

> On Tuesday, 16 June 2015 at 23:52:26 UTC, bitwise wrote:
>> I would like to try LDC, so I'll probably give it a go next release. It  
>> looks like the runtime for LDC would need some work too though. In  
>> particular, it doesn't seem to support dynamic loading:
>> https://github.com/ldc-developers/druntime/blob/ldc/src/rt/sections_ldc.d#L379
>
> Well, this is the old LDC-specific implementation for all platforms that  
> have not been converted to the new scheme yet. You'd probably want to  
> base your implementation on sections_linux, which we use on Linux.
>
> The code that emits the global constructors/destructors is here:  
> https://github.com/ldc-developers/ldc/blob/33befca6d72fe267ee8e4179ba670513993e2eb7/gen/module.cpp#L348-L546
>
>   - David

The llvm codegen is certainly easier on the eyes ;)

When I started porting my library though, I fumbled around with a bunch of  
compilers and build commands trying to get D/C++ interop to work right.  
xcode's default compiler seems to work nicely with dmd, so I went with  
that. Other combinations where giving me strange linker errors.


As far as the runtime code, I understand most of what's going on, but I'm  
still confused about the purpose of ThreadDSO, and what these are for:
  pinLoadedLibraries()
  unpinLoadedLibraries()
  inheritLoadedLibraries()
  cleanupLoadedLibraries()

   Bit


More information about the Digitalmars-d mailing list