On 26 July 2014 09:37, Jacob Carlborg via Digitalmars-d <[email protected]> wrote: > On Friday, 25 July 2014 at 22:15:15 UTC, Andrei Alexandrescu wrote: > >> We've just open-sourced another D project at Facebook (just a developer >> beta), an ODBC driver for the Presto database engine: >> https://github.com/prestodb/presto-odbc. >> >> The Windows version works well now, and Mark Isaacson (the author of the >> driver and incidentally my intern) is working already on the OSX port using >> iODBC. We've hit a number of issues, the most basic one being that shared >> static this() initializers don't seem to be called for our driver. > > > There is no equivalent to DllMain on OS X or Posix for that matter. The > closest you get is the GCC/Clang attribute __attribute__((constructor)), but > that requires using a C file, if not LDC or GDC supports that attribute. > > Just for the record, dynamic libraries doesn't work yet on OS X in D. At > least not properly. This might be the reason why shared static this() isn't > called. >
shared static this() shouldn't be called directly when the library loads. It's invocation is handled by D runtime module loaders/unloaders.
