Bug 9680 – Include entry point location in "dmd -v -o-" output

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-09T21:04:00Z
Last change time
2013-04-07T22:41:08Z
Keywords
pull
Assigned to
andrej.mitrovich
Creator
dlang-bugzilla

Comments

Comment #0 by dlang-bugzilla — 2013-03-09T21:04:48Z
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.
Comment #1 by andrej.mitrovich — 2013-03-09T21:38:51Z
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.
Comment #2 by dlang-bugzilla — 2013-03-09T21:45:05Z
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?)
Comment #3 by andrej.mitrovich — 2013-03-09T21:55:59Z
Comment #4 by github-bugzilla — 2013-04-05T05:03:56Z
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.
Comment #5 by github-bugzilla — 2013-04-07T22:41:08Z