Thread overview
[Issue 9680] New: Include entry point location in "dmd -v -o-" output
Mar 10, 2013
Vladimir Panteleev
Mar 10, 2013
Andrej Mitrovic
Mar 10, 2013
Vladimir Panteleev
Mar 10, 2013
Andrej Mitrovic
Apr 05, 2013
Kenji Hara
March 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9680

           Summary: Include entry point location in "dmd -v -o-" output
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: thecybershadow@gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow@gmail.com> 2013-03-10 07:04:48 EET ---
This is an enhancement request.

I would like it if dmd would print a line on the standard output when it encounters an entry point function ("main" or "WinMain"). Optionally, the module name where it was found should be printed as well.

This will allow build tools, like rdmd, to react intelligently based on what is specified on the command-line. If there is no entry point defined, the build tool may select to skip linking, or build a library, instead of attempting to link an executable (which will likely fail due to lack of an entry point).

In my case, it would allow creating a file manager association with .d files, such that executing the association on a main program file would compile and link the program, and executing the association on a component module would merely check the code for compilation errors.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9680


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-03-09 21:38:51 PST ---
From what I can tell there's 3 types of main functions:

main
WinMain
DllMain

So how would you like the output to be? It could be:

binary    E:\dmd-git\dmd2\windows\bin\dmd.exe
version   v2.063
config    E:\dmd-git\dmd2\windows\bin\sc.ini
parse     Fix9680
importall test
import    object
(E:\dmd-git\dmd2\windows\bin\..\..\src\druntime\import\object.di)
import    foo.bar    (foo\bar.d)
semantic  test
main      foo\bar.d  <-
winmain   foo\bar.d  <-
dllmain   foo\bar.d  <-
semantic2 test
semantic3 test
code      test

Either one of the 3 marked with the arrow would show up, or perhaps you want some other way of marking them?

I can have a pull ready soon.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9680



--- Comment #2 from Vladimir Panteleev <thecybershadow@gmail.com> 2013-03-10 07:45:05 EET ---
Oh, good point about printing the entry point kind (winmain/dllmain)! Then the build tool could also do the right thing and build a DLL, or pass "/SUBSYSTEM:WINDOWS" to the linker.

How about this format:

entry    main    foo\bar.d

"entry" is constant, "main" is the entry point kind (main/winmain/dllmain), and
the third field is the path name. This leaves room for detecting other kinds of
entry points if that's something that might happen (extern(C) main?)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9680


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-03-09 21:55:59 PST ---
https://github.com/D-Programming-Language/dmd/pull/1732

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9680



--- Comment #4 from github-bugzilla@puremagic.com 2013-04-05 05:03:56 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/4ca8a034c89c7c2bc8fe083d3770c0d17a176fcc Fixes Issue 9680 - Print main function and location in verbose mode.

Add test-case script by Kenji Hara.

https://github.com/D-Programming-Language/dmd/commit/39ffb26b35a9645a543331ab06fb2d8f68420cf7 Merge pull request #1732 from AndrejMitrovic/Fix9680

Issue 9680 - Print main function and location in verbose mode.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9680


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9680



--- Comment #5 from github-bugzilla@puremagic.com 2013-04-07 22:41:08 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/12c8c9d2500008ecb54d10500c69b10f9c0a685f Fixup test case for Issue 9680.

https://github.com/D-Programming-Language/dmd/commit/2d8d2abbe5757c49a7ac08a0165822dc2bd29051 Merge pull request #1862 from AndrejMitrovic/Fixup9680

Fixup test case for Issue 9680.

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