On Tue, 16 Jun 2015 15:50:32 -0400, Jacob Carlborg <[email protected]> wrote:
On 2015-06-16 16:56, bitwise wrote:
If anyone is willing to point me in the right direction here, it would
be much appreciated ;)
Looking at Martin's github, it doesn't appear that he's back in business
yet.
Why don't you just do what Martin did for Linux, or is that what you
would like to avoid? The code was a bit more than I first thought it
would be. You could try doing the same for OS X and see what happens :).
Just replace the segments and section names with the appropriate OS X
names and similar stuff.
Heh... trying ;)
Here, there seems to be a function to put things in ctors/dtors, but it
looks like it was copy pasted from the Elf code:
https://github.com/D-Programming-Language/dmd/blob/c718790165c3124c61e510d8352b9cb9d8ae0198/src/backend/machobj.c#L1532
I've rewritten the first line as follows, but still working on what I need
to do to actually put the function in there.
IDXSEC seg = s->Sseg = MachObj::getsegment("__mod_init_func", "__DATA", 2,
S_MOD_INIT_FUNC_POINTERS);
I think the S_COALESCED flag could be added to the above to allow a
definition in every obj file like Martin's approach, but I would rather
have an explicit DllMain and put the init code in that one obj file. It
seems more intuitive to me.
So if I get Obj::staticctor and Obj::staticdtor working on osx, that's
half the problem solved... I think.
Bit