Bug 19195 – Support pragma to specify linker directives

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2018-08-27T02:05:11Z
Last change time
2018-09-06T06:19:02Z
Assigned to
No Owner
Creator
Manu

Comments

Comment #0 by turkeyman — 2018-08-27T02:05:11Z
MSVC emits a bunch of "/FAILIFMISMATCH:" directives to object files. These express the state of various conditions during compilation, and guard against incorrect linking. Please add a pragma to emit these to object files in the same way as pragma(lib, ) does for the "/DEFAULTLIB:" directive. Perhaps a general `pragma(linkdirective, "text")` could be added to support raw directives as required, and future-proof against this class of problem. For example: pragma(linkdirective, "/FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2"); May appear in a source file under a version() where struct's are specified accordingly to match such configuration of the MSCRT.
Comment #1 by turkeyman — 2018-09-02T09:10:42Z
Comment #2 by github-bugzilla — 2018-09-06T06:19:01Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/aa391954552990ee8895d74fcfc42df3ac2d1386 Fixes Issue 19195 - Support pragma to specify linker directives Added pragma(linkerDirective, "/DIRECTIVE") https://github.com/dlang/dmd/commit/adeb9bb868872e519f3f93ca478ecb566f7e8f95 Merge pull request #8654 from TurkeyMan/linkerdirective Fixes Issue 19195 - Support pragma to specify linker directives merged-on-behalf-of: Mathias LANG <[email protected]>