Thread overview
[Issue 2764] New: Skip link if main not found
Mar 27, 2009
d-bugmail
Mar 27, 2009
d-bugmail
Mar 27, 2009
d-bugmail
Mar 29, 2009
d-bugmail
March 27, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2764

           Summary: Skip link if main not found
           Product: D
           Version: 2.026
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: steve.teale@britseyeview.com


If when compiling a bunch of D files none is found to contain main(), skip the link and output a simple message.


-- 

March 27, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2764





------- Comment #1 from bugzilla@digitalmars.com  2009-03-27 03:12 -------
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().


-- 

March 27, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2764





------- Comment #2 from maxmo@pochta.ru  2009-03-27 09:33 -------
Doesn't link fail if there is no main?


-- 

March 29, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2764


unknown@simplemachines.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |unknown@simplemachines.org




------- Comment #3 from unknown@simplemachines.org  2009-03-28 23:16 -------
(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]


--