October 01, 2015 [Issue 15060] Can't load a D shared library first, then load a C shared library | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15060 --- Comment #11 from ponce <aliloko@gmail.com> --- :X Thanks!!! can't believe I forgot that. -- |
October 02, 2015 [Issue 15060] Can't load a D shared library first, then load a C shared library | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15060 --- Comment #12 from bitwise <nicolas.jinchereau@gmail.com> --- (In reply to Jacob Carlborg from comment #10) > (In reply to ponce from comment #9) > > If this need back-end support, maybe Walter could implement global ctor/dtor like in LDC? > > DMD already does what's necessary for ELF (Linux, FreeBSD). Just do the same > for Mach-O and OS X. >> DMD already does what's necessary for ELF (Linux, FreeBSD). Just do the same >> for Mach-O and OS X. That's easier said than done ;) Making druntime compile as a shared lib and making it support multiple images is the easy part. Modifying DMD to output the ctors/dtors properly is much more difficult than it sounds. The current solution outputs the ctors/dtors by manually outputting byte codes: https://github.com/D-Programming-Language/dmd/blob/master/src/backend/elfobj.c#L3183 This is why I was saying we should just add some(or one special one) pragmas that will allow this to be done in the front end. >> @bitwise: how much would you take to do it? :)) Wish I knew how =/ -- |
October 02, 2015 [Issue 15060] Can't load a D shared library first, then load a C shared library | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15060 --- Comment #13 from Jacob Carlborg <doob@me.com> --- (In reply to bitwise from comment #12) > (In reply to Jacob Carlborg from comment #10) > >> DMD already does what's necessary for ELF (Linux, FreeBSD). Just do the same > >> for Mach-O and OS X. > > That's easier said than done ;) :) > This is why I was saying we should just add some(or one special one) pragmas that will allow this to be done in the front end. I don't think this can be completely done in the front end. The code (or that function) that should be run as a global ctor/dtor need to be placed in a special segment/section, if I recall correctly. -- |
October 02, 2015 [Issue 15060] Can't load a D shared library first, then load a C shared library | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15060 --- Comment #14 from bitwise <nicolas.jinchereau@gmail.com> --- (In reply to Jacob Carlborg from comment #13) > (In reply to bitwise from comment #12) > > (In reply to Jacob Carlborg from comment #10) > > >> DMD already does what's necessary for ELF (Linux, FreeBSD). Just do the same > > >> for Mach-O and OS X. > > > > That's easier said than done ;) > > :) > > > This is why I was saying we should just add some(or one special one) pragmas that will allow this to be done in the front end. > > I don't think this can be completely done in the front end. The code (or that function) that should be run as a global ctor/dtor need to be placed in a special segment/section, if I recall correctly. Right, which is why I am recommending the special pragmas(or pragma). -- |
October 02, 2015 [Issue 15060] Can't load a D shared library first, then load a C shared library | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15060 --- Comment #15 from bitwise <nicolas.jinchereau@gmail.com> --- (In reply to bitwise from comment #14) > (In reply to Jacob Carlborg from comment #13) > > [...] > > Right, which is why I am recommending the special pragmas(or pragma). Basically, we need these: pragma(attribute, weak) pragma(visibility, hidden) pragma(section, "__mod_init_func"); pragma(section, "__mod_term_func"); -- |
December 17, 2022 [Issue 15060] Can't load a D shared library first, then load a C shared library | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15060 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P2 -- |
Copyright © 1999-2021 by the D Language Foundation