Bug 16546 – ordering of modules matters for pragma(lib) on linux
Status
RESOLVED
Resolution
WONTFIX
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-09-26T19:00:00Z
Last change time
2017-07-05T19:12:50Z
Assigned to
nobody
Creator
timothee.cour2
Comments
Comment #0 by timothee.cour2 — 2016-09-26T19:00:01Z
module ordering on command line (or indirectly via a call to rdmd) shouldn't matter, but on linux it seems the ordering of '-lfoo -lbar' matters when foo depends on bar, one ordering giving undefined symbol errors.
what about providing a hook that allows user to postprocess the command line before calling the linker?
Comment #1 by timothee.cour2 — 2016-09-26T19:04:50Z
Comment #2 by dlang-bugzilla — 2017-07-05T19:12:50Z
As far as I can tell, I don't think a change in the language is needed. If you wish to link against a library which has a dependency, then specify the dependency in the same module. I.e. if in you example libbar depends on libfoo, change mod2.d to:
module mod2;
pragma(lib,"foo");
pragma(lib,"bar");