Thread overview | |||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 27, 2004 WinMain | ||||
---|---|---|---|---|
| ||||
The website gives this form for WinMain:
----------
import std.c.windows.windows;
extern (C) void gc_init();
extern (C) void gc_term();
extern (C) void _minit();
extern (C) void _moduleCtor();
extern (C) void _moduleUnitTests();
extern (Windows)
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow) {
int result;
gc_init();
_minit();
try {
_moduleCtor();
_moduleUnitTests();
result = doit();
}
catch (Object o) {
MessageBoxA(null, (char *)o.toString(), "Error",
MB_OK | MB_ICONEXCLAMATION);
result = 0;
}
gc_term();
return result;
}
----------
I've been using a slightly different version, which works as far as I
can see:
----------
import std.c.windows.windows;
extern (C) void gc_init();
extern (C) void gc_term();
extern (C) void _minit();
extern (C) void _moduleCtor();
extern (C) void _moduleUnitTests();
extern (Windows)
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow) {
gc_init();
_minit();
try {
_moduleCtor();
_moduleUnitTests();
return doit();
}
catch (Object o) {
MessageBoxA(null, (char *)o.toString(), "Error",
MB_OK | MB_ICONEXCLAMATION);
return 0;
}
finally {
gc_term();
}
}
----------
But is there any possible reason not to use this form? If not, I'm
inclined to suggest putting this one in the documentation in place of
the other one, as it seems neater and more logical.
Stewart.
--
My e-mail is valid but not my primary mailbox, aside from its being the
unfortunate victim of intensive mail-bombing at the moment. Please keep
replies on the 'group where everyone may benefit.
|
February 27, 2004 Re: WinMain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | In Visual C++, you can set the entry point to main intead of WinMain. On Fri, 27 Feb 2004 13:45:57 +0000, Stewart Gordon <smjg_1998@yahoo.com> wrote: > The website gives this form for WinMain: > > ---------- > import std.c.windows.windows; > > extern (C) void gc_init(); > extern (C) void gc_term(); > extern (C) void _minit(); > extern (C) void _moduleCtor(); > extern (C) void _moduleUnitTests(); > > extern (Windows) > int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, > LPSTR lpCmdLine, int nCmdShow) { > int result; > > gc_init(); > _minit(); > > try { > _moduleCtor(); > _moduleUnitTests(); > > result = doit(); > } > > catch (Object o) { > MessageBoxA(null, (char *)o.toString(), "Error", > MB_OK | MB_ICONEXCLAMATION); > result = 0; > } > > gc_term(); > return result; > } > ---------- > > I've been using a slightly different version, which works as far as I > can see: > > ---------- > import std.c.windows.windows; > > extern (C) void gc_init(); > extern (C) void gc_term(); > extern (C) void _minit(); > extern (C) void _moduleCtor(); > extern (C) void _moduleUnitTests(); > > extern (Windows) > int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, > LPSTR lpCmdLine, int nCmdShow) { > gc_init(); > _minit(); > > try { > _moduleCtor(); > _moduleUnitTests(); > > return doit(); > } > > catch (Object o) { > MessageBoxA(null, (char *)o.toString(), "Error", > MB_OK | MB_ICONEXCLAMATION); > return 0; > } > > finally { > gc_term(); > } > } > ---------- > > But is there any possible reason not to use this form? If not, I'm > inclined to suggest putting this one in the documentation in place of > the other one, as it seems neater and more logical. > > Stewart. > -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
February 27, 2004 Re: WinMain | ||||
---|---|---|---|---|
| ||||
Posted in reply to SpookyET | SpookyET wrote:
> In Visual C++, you can set the entry point to main intead of WinMain.
I completely fail to understand how this correlates to D programming. It's like saying 'in PHP <? demarks the entry point'...
And I had such high hopes for that Dvorak keyboard of yours.
Cheers,
Sigbjørn Lund Olsen
|
February 27, 2004 Re: WinMain | ||||
---|---|---|---|---|
| ||||
Posted in reply to SpookyET | SpookyET wrote: > In Visual C++, you can set the entry point to main intead of WinMain. <snip top of upside-down reply> What has C++ to do with the price of troll-meat? Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit. |
February 27, 2004 Re: WinMain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | Stewart Gordon wrote:
> SpookyET wrote:
>
>> In Visual C++, you can set the entry point to main intead of WinMain.
>
> <snip top of upside-down reply>
>
> What has C++ to do with the price of troll-meat?
>
> Stewart.
>
now I'm going to troll a bit ;-)
maybe his comments aren't always to the point but he's not the one being negative towards other people.
The first one that never makes a remark that's not 100% spot on, may throw the first stone. (Where did I here that?)
If the D community wants to expand it'll take a lot more of your nerves the coming years and my advice is that your should give up now.
bye guys,
roel
|
February 27, 2004 Re: WinMain | ||||
---|---|---|---|---|
| ||||
Posted in reply to SpookyET | SpookyET wrote:
> In Visual C++, you can set the entry point to main intead of WinMain.
>
WinMain is stupid to begin with, but I don't think D is the place to try and fix it. (much like trying to fix win32)
-- andy
|
February 27, 2004 Re: WinMain | ||||
---|---|---|---|---|
| ||||
Posted in reply to SpookyET | In article <opr31aoudf1s9n15@saturn>, SpookyET says...
>
>In Visual C++, you can set the entry point to main intead of WinMain.
>
You can do that in D too.
-------------------
Carlos Santander B.
|
February 27, 2004 Re: WinMain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | In article <c1nhml$1of2$1@digitaldaemon.com>, Stewart Gordon says... > >The website gives this form for WinMain: > >---------- >import std.c.windows.windows; > >extern (C) void gc_init(); >extern (C) void gc_term(); >extern (C) void _minit(); >extern (C) void _moduleCtor(); >extern (C) void _moduleUnitTests(); > >extern (Windows) >int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, > LPSTR lpCmdLine, int nCmdShow) { > int result; > > gc_init(); > _minit(); > > try { > _moduleCtor(); > _moduleUnitTests(); > > result = doit(); > } > > catch (Object o) { > MessageBoxA(null, (char *)o.toString(), "Error", > MB_OK | MB_ICONEXCLAMATION); > result = 0; > } > > gc_term(); > return result; >} >---------- > >I've been using a slightly different version, which works as far as I can see: > >---------- >import std.c.windows.windows; > >extern (C) void gc_init(); >extern (C) void gc_term(); >extern (C) void _minit(); >extern (C) void _moduleCtor(); >extern (C) void _moduleUnitTests(); > >extern (Windows) >int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, > LPSTR lpCmdLine, int nCmdShow) { > gc_init(); > _minit(); > > try { > _moduleCtor(); > _moduleUnitTests(); > > return doit(); > } > > catch (Object o) { > MessageBoxA(null, (char *)o.toString(), "Error", > MB_OK | MB_ICONEXCLAMATION); > return 0; > } > > finally { > gc_term(); > } >} >---------- > >But is there any possible reason not to use this form? If not, I'm inclined to suggest putting this one in the documentation in place of the other one, as it seems neater and more logical. > >Stewart. > >-- >My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit. I might be wrong, but in your version, the program returns before the 'finally', so maybe gc_term is not called. Can't test it now, though. ------------------- Carlos Santander B. |
February 28, 2004 Re: WinMain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | "Carlos Santander B." <Carlos_member@pathlink.com> wrote in message news:c1ofnp$ck1$1@digitaldaemon.com... > In article <c1nhml$1of2$1@digitaldaemon.com>, Stewart Gordon says... > > > >The website gives this form for WinMain: > > > >---------- > >import std.c.windows.windows; > > > >extern (C) void gc_init(); > >extern (C) void gc_term(); > >extern (C) void _minit(); > >extern (C) void _moduleCtor(); > >extern (C) void _moduleUnitTests(); > > > >extern (Windows) > >int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, > > LPSTR lpCmdLine, int nCmdShow) { > > int result; > > > > gc_init(); > > _minit(); > > > > try { > > _moduleCtor(); > > _moduleUnitTests(); > > > > result = doit(); > > } > > > > catch (Object o) { > > MessageBoxA(null, (char *)o.toString(), "Error", > > MB_OK | MB_ICONEXCLAMATION); > > result = 0; > > } > > > > gc_term(); > > return result; > >} > >---------- > > > >I've been using a slightly different version, which works as far as I can see: > > > >---------- > >import std.c.windows.windows; > > > >extern (C) void gc_init(); > >extern (C) void gc_term(); > >extern (C) void _minit(); > >extern (C) void _moduleCtor(); > >extern (C) void _moduleUnitTests(); > > > >extern (Windows) > >int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, > > LPSTR lpCmdLine, int nCmdShow) { > > gc_init(); > > _minit(); > > > > try { > > _moduleCtor(); > > _moduleUnitTests(); > > > > return doit(); > > } > > > > catch (Object o) { > > MessageBoxA(null, (char *)o.toString(), "Error", > > MB_OK | MB_ICONEXCLAMATION); > > return 0; > > } > > > > finally { > > gc_term(); > > } > >} > >---------- > > > >But is there any possible reason not to use this form? If not, I'm inclined to suggest putting this one in the documentation in place of the other one, as it seems neater and more logical. > > > >Stewart. > > > >-- > >My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit. > > I might be wrong, but in your version, the program returns before the 'finally', > so maybe gc_term is not called. Can't test it now, though. If finally has the same semantics as in Java/.NET this would not work. |
February 28, 2004 Re: WinMain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Roel Mathys | "Roel Mathys" <roel.mathys@yucom.be> wrote in message news:c1obba$4e1$1@digitaldaemon.com... > Stewart Gordon wrote: > > SpookyET wrote: > > > >> In Visual C++, you can set the entry point to main intead of WinMain. > > > > <snip top of upside-down reply> > > > > What has C++ to do with the price of troll-meat? > > > > Stewart. > > > > now I'm going to troll a bit ;-) > > maybe his comments aren't always to the point but he's not the one being > negative towards other people. > The first one that never makes a remark that's not 100% spot on, may > throw the first stone. (Where did I here that?) I think you heard that in the Bible, I think it says "Let he that hath no sin, cast the first stone" Beleive it or not I remember that from about 30 years ago, when I went to Sunday school. Not that I follow this rule, unfortunately :o)) Phill. |
Copyright © 1999-2021 by the D Language Foundation