Equivalent of DllMain for OSX dynamic libraries?
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jul 26 01:37:37 PDT 2014
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.
Documentation for dynamic libraries on OS X:
https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/000-Introduction/Introduction.html
More information about the Digitalmars-d
mailing list