Bug 20340 – [betterC] -main inserts D main function even with betterC
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2019-10-30T20:56:20Z
Last change time
2021-08-27T06:40:57Z
Keywords
pull
Assigned to
No Owner
Creator
John Hall
Comments
Comment #0 by john.michael.hall — 2019-10-30T20:56:20Z
When I call dmd -betterC -main with a simple function, then I get an error that
onlineapp.o:__main.d:function main: error: undefined reference to '_d_run_main'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
In other words, -main still inserts a D main function even with betterC. The -main flag should be adjusted so that it does something like below
version(D_BetterC) {
extern(C) void main() {
}
}
Comment #1 by dlang-bot — 2021-08-26T16:21:24Z
@jrfondren created dlang/dmd pull request #13025 "Fix issue 20340 - -main inserts D main function even with betterC" fixing this issue:
- Fix issue 20340 - -main inserts D main function even with betterC
https://github.com/dlang/dmd/pull/13025
Comment #2 by dlang-bot — 2021-08-27T06:40:57Z
dlang/dmd pull request #13025 "Fix issue 20340 - -main inserts D main function even with betterC" was merged into master:
- 948d2fe1fd937a58f37af98bf30566f5c3f8065b by Julian Fondren:
Fix issue 20340 - -main inserts D main function even with betterC
https://github.com/dlang/dmd/pull/13025