www.digitalmars.com         C & C++   DMDScript  

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

https://issues.dlang.org/show_bug.cgi?id=20340

          Issue ID: 20340
           Summary: [betterC] -main inserts D main function even with
                    betterC
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: john.michael.hall 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() {
    }
}

--
Oct 30 2019