Bug 2764 – Skip link if main not found

Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-03-27T02:07:00Z
Last change time
2016-10-14T01:11:26Z
Assigned to
bugzilla
Creator
steve.teale

Comments

Comment #0 by steve.teale — 2009-03-27T02:07:12Z
If when compiling a bunch of D files none is found to contain main(), skip the link and output a simple message.
Comment #1 by bugzilla — 2009-03-27T03:12:42Z
I thought some more about this, and there's a problem. A module may not have a main(), but it may reference another function in a library that does have a main().
Comment #2 by dfj1esp02 — 2009-03-27T09:33:49Z
Doesn't link fail if there is no main?
Comment #3 by bugs-d — 2009-03-28T23:16:06Z
(In reply to comment #1) > I thought some more about this, and there's a problem. A module may not have a > main(), but it may reference another function in a library that does have a > main(). I think this is an important use-case. More specifically, things like WinMain(), etc. DMD doesn't special-case those for you, so it's likely a framework/toolkit might write your WinMain for you and give you a D function to hook in. Although I'd do that with a template, myself. The best solution would be altering the linker, just so slightly, to output an easier to understand message than "no start address." As exactly correct as this message may be, programmers more interested in application programming than systems programming may be very perplexed. That said, the most common case is when compiling with new libs - just the default. Maybe a solution is to show this error whenever no libs are passed in, and add a switch (beside defaultlib) to suppress the error for other default libraries? It is only to improve documentation, after all. -[Unknown]
Comment #4 by andrei — 2013-11-15T21:24:44Z
downgrading to enhancement
Comment #5 by andrei — 2016-10-14T01:11:26Z
Seems to me this is insufficiently motivated and specified. Will close, please reopen if deemed necessary.