[Issue 20340] New: [betterC] -main inserts D main function even with betterC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 30 20:56:20 UTC 2019


          Issue ID: 20340
           Summary: [betterC] -main inserts D main function even with
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: john.michael.hall at gmail.com

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() {


More information about the Digitalmars-d-bugs mailing list