Bug 8130 – Memory corruption because without *.def file DMD compiles DLL with assumption `_tls_index = 0`

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2012-05-21T07:09:00Z
Last change time
2015-06-09T05:11:51Z
Keywords
wrong-code
Assigned to
nobody
Creator
verylonglogin.reg

Attachments

IDFilenameSummaryContent-TypeSize
1109bug-8130-test.7zTest for bug 8130application/octet-stream174122

Comments

Comment #0 by verylonglogin.reg — 2012-05-21T07:09:46Z
Also without *.def file exported `extern(C)` symbols are prefixed with `_` and require this prefix when obtained with GetProcAddress. DMD should ether reject compiling DLL without module definition file or tell optling that output is a library. If there are reasons not to change current behavior, this trap should be mentioned on top of dll.html (preferable in red color) and all D IDE developers should be notified about this issue and catch such case on IDE level.
Comment #1 by verylonglogin.reg — 2012-05-21T07:12:18Z
Created attachment 1109 Test for bug 8130
Comment #2 by verylonglogin.reg — 2012-05-21T07:16:16Z
By the way, this is required *.def file content: --- LIBRARY EXETYPE NT SUBSYSTEM WINDOWS ---
Comment #3 by verylonglogin.reg — 2012-10-10T10:01:09Z
As a proof of this issue odiousness: http://forum.dlang.org/thread/[email protected]
Comment #4 by bugzilla — 2013-04-07T15:00:37Z
Comment #5 by bugzilla — 2013-04-07T15:30:16Z
Comment #6 by github-bugzilla — 2013-04-07T18:53:41Z
Commits pushed to master at https://github.com/D-Programming-Language/d-programming-language.org https://github.com/D-Programming-Language/d-programming-language.org/commit/9bb8e01e1d53b9f3386d758c970f27646d014f49 fix Issue 8130 - Memory corruption because without *.def file DMD compiles DLL with assumption https://github.com/D-Programming-Language/d-programming-language.org/commit/ce9aa6f8b654af62a23e23fd51b2792ab5b4df03 Merge pull request #313 from WalterBright/fix8130 fix Issue 8130 - Memory corruption because without *.def file DMD compil...
Comment #7 by github-bugzilla — 2013-04-07T19:14:50Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/efef6e99ec2d98cd100dd8f028be3389bbb80490 fix Issue 8130 - Memory corruption because without *.def file DMD compiles DLL with assumption https://github.com/D-Programming-Language/dmd/commit/3c2e4506f118ce6a9c8f6134123acafa47dec7c2 Merge pull request #1864 from WalterBright/fix8130 fix Issue 8130 - Memory corruption because without *.def file DMD compil...
Comment #8 by github-bugzilla — 2013-04-07T20:23:44Z
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4efb4c936a6a56e20c8b0056b5011ef396753480 Merge pull request #1864 from WalterBright/fix8130 fix Issue 8130 - Memory corruption because without *.def file DMD compil...
Comment #9 by verylonglogin.reg — 2013-04-07T23:44:17Z
So, the issue is fixed by documentation improvement. Can you also tell reasons not to change current compiler behavior?
Comment #10 by bugzilla — 2013-04-08T01:03:59Z
(In reply to comment #9) > So, the issue is fixed by documentation improvement. Can you also tell reasons > not to change current compiler behavior? see https://github.com/D-Programming-Language/dmd/pull/1864
Comment #11 by verylonglogin.reg — 2013-04-08T01:22:28Z
(In reply to comment #10) > (In reply to comment #9) > > So, the issue is fixed by documentation improvement. Can you also tell reasons > > not to change current compiler behavior? > > see https://github.com/D-Programming-Language/dmd/pull/1864 Sorry. Missed a compiler change pull.