osx shared libraries.

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 6 12:09:10 PDT 2015


On Sat, 06 Jun 2015 14:52:11 -0400, bitwise <bitwise.pvt at gmail.com> wrote:
> Any ideas on this would be much appreciated.
>
> Thanks,
>    Bit

One thought that just occurred to me would be to require that D dynamic  
libraries contain a main entry point, like DllMain on Windows. This seems  
like the only real/reliable option.

The coder would have to explicitly give dmd a module in which to place the  
constructor/destructor code for images, the same way that dmd adds a  
C-main in the file where D-main is found. Enforcing this in the future  
would be a breaking change, but not a dangerous one. It would be a simple  
link-time error which was easy to fix.

Also, requiring all D binaries to have some kind of entry point would  
alleviate the need to ever call Runtime.initialize() explicitly.

   Bit


More information about the Digitalmars-d mailing list