Carlos Santander B.
Posted in reply to Charles
| "Charles" <sanders-consulting@comcast.net> wrote in message
news:brmcio$2rgg$1@digitaldaemon.com...
| > -if the compiler recognize the "winmain" keyword it knows it is a
windows
| app?
| > so, if it is the case, why the .def file?
|
| Sometimes its desireable to have it run from a dos prompt, for debugging
| purposes.
|
| Also, you don't need the .def file if thats all your wanting, the linker
| flags
|
| EXET:NT
|
| and
|
| SU:windows
|
| will do what you want, on the command line it looks like
|
| dmd -L/EXET:NT -L/SU:windows myWinApp.d
|
| But I like your idea's of having the compiler include those for you if
| WinMain is detected, if we had a way to override it that would be great.
| Good ideas keep'em coming!
|
| C
|
|
| "Felix" <Felix_member@pathlink.com> wrote in message
| news:brmc6s$2qtk$1@digitaldaemon.com...
| > Thks, but I do not think there is any great stuff in my message. What I
| liked to
| > know was, basically:
| >
| > -why the filename.def is required when programming win32 apps? I quote
the
| docs:
| >
| > "
| > A .def (Module Definition File) with at least the following two lines in
| it:
| >
| > EXETYPE NT
| > SUBSYSTEM WINDOWS
| >
| > Without those, Win32 will open a text console window whenever the
| application is
| > run.
| > "
| > I see no reason, once the application is a win32 one, why it opens a
text
| > console window? For the stub? (i.e. the little program which displays
| "This
| > program cannot be run in MS-DOS mode" or "This program requires Microsft
| > Windows") It is still useful (the stub itself) nowadays?
| > -more, if the lines in .def file are required, one may replace 'em by
some
| > #pragma's directives? as: "#pragma def exetype nt" etc. It is easier to
| use than
| > another file...
| > -And the last: are "WinMain", "DllMain" etc. reserved keywords under D?
I
| quote:
| > "
| > The presence of WinMain() is recognized by the compiler causing it to
emit
| a
| > reference to __acrtused_dll and the phobos.lib runtime library.
| > "
| > This means that:
| > -if the compiler recognize the "winmain" keyword it knows it is a
windows
| app?
| > so, if it is the case, why the .def file?
| > -can I have a "winmain" function in a linux/dos program? Why we cannot
use
| > simply the old "main" keyword? Even in C/C++ these are equivalents (for
| some
| > compilers, at least).
| >
| > I hope these new examples are clearer. Sorry if I repeat something that
| was
| > already discussed.
| >
| >
| >
| >
| > In article <brlkoa$1nrj$1@digitaldaemon.com>, Georg Wrede says...
| > >
| > >In article <brkpp9$d7t$1@digitaldaemon.com>, Felix says...
| > >>Sorry if the message is clumsier than the "clumsy" word...
| > >
| > >Happens to me, too, sometimes. You may want to review
| > >the message, and then rewrite it so that "the less fortunate"
| > >in this newsgroup can handle it (including me...), too.
| > >
| > >After all, it really looked like you had some valid and very
| > >relevant questions.
| > >
| > >georg
| > >
| > >
| >
| >
|
|
There's no need for WinMain. If you pass "-L/EXET:NT/SU:windows" as Charles
said, you can write your program with main and everything goes fine.
Also, when creating a dll, you can use the "export" keyword and you won't
need to write a .def for it.
—————————————————————————
Carlos Santander
"Charles" <sanders-consulting@comcast.net> wrote in message
news:brmcio$2rgg$1@digitaldaemon.com...
| > -if the compiler recognize the "winmain" keyword it knows it is a
windows
| app?
| > so, if it is the case, why the .def file?
|
| Sometimes its desireable to have it run from a dos prompt, for debugging
| purposes.
|
| Also, you don't need the .def file if thats all your wanting, the linker
| flags
|
| EXET:NT
|
| and
|
| SU:windows
|
| will do what you want, on the command line it looks like
|
| dmd -L/EXET:NT -L/SU:windows myWinApp.d
|
| But I like your idea's of having the compiler include those for you if
| WinMain is detected, if we had a way to override it that would be great.
| Good ideas keep'em coming!
|
| C
|
|
| "Felix" <Felix_member@pathlink.com> wrote in message
| news:brmc6s$2qtk$1@digitaldaemon.com...
| > Thks, but I do not think there is any great stuff in my message. What I
| liked to
| > know was, basically:
| >
| > -why the filename.def is required when programming win32 apps? I quote
the
| docs:
| >
| > "
| > A .def (Module Definition File) with at least the following two lines in
| it:
| >
| > EXETYPE NT
| > SUBSYSTEM WINDOWS
| >
| > Without those, Win32 will open a text console window whenever the
| application is
| > run.
| > "
| > I see no reason, once the application is a win32 one, why it opens a
text
| > console window? For the stub? (i.e. the little program which displays
| "This
| > program cannot be run in MS-DOS mode" or "This program requires Microsft
| > Windows") It is still useful (the stub itself) nowadays?
| > -more, if the lines in .def file are required, one may replace 'em by
some
| > #pragma's directives? as: "#pragma def exetype nt" etc. It is easier to
| use than
| > another file...
| > -And the last: are "WinMain", "DllMain" etc. reserved keywords under D?
I
| quote:
| > "
| > The presence of WinMain() is recognized by the compiler causing it to
emit
| a
| > reference to __acrtused_dll and the phobos.lib runtime library.
| > "
| > This means that:
| > -if the compiler recognize the "winmain" keyword it knows it is a
windows
| app?
| > so, if it is the case, why the .def file?
| > -can I have a "winmain" function in a linux/dos program? Why we cannot
use
| > simply the old "main" keyword? Even in C/C++ these are equivalents (for
| some
| > compilers, at least).
| >
| > I hope these new examples are clearer. Sorry if I repeat something that
| was
| > already discussed.
| >
| >
| >
| >
| > In article <brlkoa$1nrj$1@digitaldaemon.com>, Georg Wrede says...
| > >
| > >In article <brkpp9$d7t$1@digitaldaemon.com>, Felix says...
| > >>Sorry if the message is clumsier than the "clumsy" word...
| > >
| > >Happens to me, too, sometimes. You may want to review
| > >the message, and then rewrite it so that "the less fortunate"
| > >in this newsgroup can handle it (including me...), too.
| > >
| > >After all, it really looked like you had some valid and very
| > >relevant questions.
| > >
| > >georg
| > >
| > >
| >
| >
|
|
There's no need for WinMain. If you pass "-L/EXET:NT/SU:windows" as Charles
said, you can write your program with main and everything goes fine.
Also, when creating a dll, you can use the "export" keyword and you won't
need to write a .def for it.
————————————————————————— Carlos Santander
|