www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2764] New: Skip link if main not found

reply d-bugmail puremagic.com writes:
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.


-- 
Mar 27 2009
next sibling parent d-bugmail puremagic.com writes:
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().


-- 
Mar 27 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
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?


-- 
Mar 27 2009
prev sibling parent d-bugmail puremagic.com writes:
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] --
Mar 28 2009