Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 14, 2011 [Issue 5573] New: Compiler (not linker) should generate an error for missing main() | ||||
---|---|---|---|---|
| ||||
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@puremagic.com ReportedBy: clugdbug@yahoo.com.au --- Comment #0 from Don <clugdbug@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: ------- |
February 14, 2011 [Issue 5573] Compiler (not linker) should generate an error for missing main() | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | http://d.puremagic.com/issues/show_bug.cgi?id=5573 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #1 from bearophile_hugs@eml.cc 2011-02-14 04:04:23 PST --- See also bug 5215, bug 4680 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 14, 2011 [Issue 5573] Compiler (not linker) should generate an error for missing main() | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | http://d.puremagic.com/issues/show_bug.cgi?id=5573 Robert Clipsham <robert@octarineparrot.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |robert@octarineparrot.com --- Comment #2 from Robert Clipsham <robert@octarineparrot.com> 2011-02-14 21:03:52 GMT --- Another possibility for this (and other linker errors) - given that dmd invokes the linker, its stderr could be redirected and filtered. The compiler can then give a nice error for a missing main() function, and also demangle symbol names without the linker needing modification. This avoids the issue of main() being in a library, but is also a bit more hacky. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 29, 2012 [Issue 5573] Compiler (not linker) should generate an error for missing main() | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | http://d.puremagic.com/issues/show_bug.cgi?id=5573 Borden Rhodes <incoming-only@bordenrhodes.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |incoming-only@bordenrhodes. | |com --- Comment #3 from Borden Rhodes <incoming-only@bordenrhodes.com> 2012-08-28 18:23:09 PDT --- I agree that the emphasis should be on clarity of the error message rather than trying to out-think the programmer. The linker dump, to uninitiated noobs like me, looks an awful lot like a seg fault or bug with the compiler, not a flaw in the programmer. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation