osx shared libraries.

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 17 08:14:52 PDT 2015


On Wed, 17 Jun 2015 02:21:31 -0400, Jacob Carlborg <doob at me.com> wrote:

> Obj::staticctor does not seem to be used for setting up the runtime.

I realize that, but I was thinking that I could just generate a DllMain in  
D code[1], and then output it as a special case[2] as is done with regular  
D main:

[1]  
https://github.com/D-Programming-Language/dmd/blob/c718790165c3124c61e510d8352b9cb9d8ae0198/src/mars.c#L228
[2]  
https://github.com/D-Programming-Language/dmd/blob/c718790165c3124c61e510d8352b9cb9d8ae0198/src/mars.c#L1669

For the second step though, I could also call staticctor/staticdtor or  
something.. still workin on it ;)


> There's a lot more code there than I first hoped.

Yeah... Writing out assembly as byte codes like that is a little too much  
for me. I think I can get by with the above solution.

I'm still having trouble finding where functions are exported though.  
Every instance of export_symbol() seems to be check first with isExport(),  
except all symbols are exported by default on OSX.... but from where?
https://github.com/D-Programming-Language/dmd/blob/c718790165c3124c61e510d8352b9cb9d8ae0198/src/toobj.c#L572

It seems like it could be in either out.c or machobj.c, but I still  
haven't found it.

   Bit


More information about the Digitalmars-d mailing list