[Issue 5573] New: Compiler (not linker) should generate an error for missing main()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 14 02:12:31 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5573

           Summary: Compiler (not linker) should generate an error for
                    missing main()
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


--- Comment #0 from Don <clugdbug at yahoo.com.au> 2011-02-14 02:09:54 PST ---
The standard linker error is (a) newbie-hostile; and 
(b) on Windows, it generates an invalid executable. Running this executable
seems to cause an infinite loop you cannot break out of.

As Walter said on the newsgroup, it's not possible to solve this in general:
> The problem is the main() can come from a library, or some other .obj 
> file handed to the compiler that the compiler doesn't look inside. It's 
> a very flexible way to build things, and trying to impose more order on 
> that will surely wind up with complaints from some developers.

But, it's only the trivial case that matters.
The compiler should generate an error if all files passed to the compiler are
.d/.di files, and there is no use of pragma(lib).
Error can be something like:
"No main function, and no .obj or .lib file which could contain one".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list