| Thread overview | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
March 16, 2005 Mixin strange behaviour (was Mixin bug, but this time i've got the real problem, read please) | ||||
|---|---|---|---|---|
| ||||
Hi to all,
i'm back to the forum to ask a question about mixins 'cuz i've found something
strange:
/*--------------------------
test 1
-------------------------*/
template Macro(alias a)
{
int main(char[][] args)
{
a();
return 0;
{
}
int Foo()
{
return 3;
}
mixin Macro!(Foo);
/*----------------------------*/
it compiles flawlessy, no problem in inlining the parametrized mixin code as te executable's main function, but when it comes to Win32 programming something strange happens:
/*----------------------------
test 2
----------------------------*/
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();
template Macro(alias a)
{
extern (Windows)
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
nCmdShow)
{
int result;
gc_init(); // initialize garbage collector
_minit(); // initialize module constructor table
try
{
_moduleCtor(); // call module constructors
_moduleUnitTests(); // run unit tests (optional)
result = a(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
}
catch (Object o) // catch any uncaught exceptions
{
//MessageBoxW(null, cast(wchar *)o.toString(), "Error", MB_OK |
MB_ICONEXCLAMATION);
result = 0; // failed
}
gc_term(); // run finalizers; terminate garbage collector
return result;
}
}
int pippo(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
nCmdShow)
{
return 3;
}
mixin Macro!(pippo);
/*-----------------------------------*/
now the strange thing: the linker cannot find _WinMain@16 simbol and reference. After some tests I've found that it acts like the extern(Windows) attribute is ignored. So I've tried putting it on both the template definition and the mixin statement but there was nothing to do :-(
Now the question:
Is this a bug? Can it be solved? Or there's a way to get around it?
"When Rome will Fall
Then the World."
| ||||
March 17, 2005 Re: Mixin strange behaviour (was Mixin bug, but this time i've got the real problem, read please) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Lox TG | Lox TG <Lox_member@pathlink.com> wrote: [...] > found something strange: [...] Would you please post here only if you are _sure_, that you are _not_ describing a bug. Otherwise send your posts to the digitalmars.bugs- NG please. There are similar posts already. For example: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/1686 -manfred | |||
March 17, 2005 Re: Mixin strange behaviour (was Mixin bug, but this time i've got the real problem, read please) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | Manfred Nowak wrote: > Lox TG <Lox_member@pathlink.com> wrote: > > [...] > >>found something strange: > > [...] > > Would you please post here only if you are _sure_, that you are _not_ describing a bug. Otherwise send your posts to the digitalmars.bugs- > NG please. Sometimes mere mortals don't know if it's a bug or not until after they post it. > There are similar posts already. For example: > http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/1686 > > -manfred -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/ | |||
March 17, 2005 Re: Mixin strange behaviour (was Mixin bug, but this time i've got | ||||
|---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | In article <d1bb4u$5u0$2@digitaldaemon.com>, J C Calvarese says... > >Manfred Nowak wrote: >> Lox TG <Lox_member@pathlink.com> wrote: >> >> [...] >> >>>found something strange: >> >> [...] >> >> Would you please post here only if you are _sure_, that you are _not_ describing a bug. Otherwise send your posts to the digitalmars.bugs- NG please. > >Sometimes mere mortals don't know if it's a bug or not until after they post it. > >> There are similar posts already. For example: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/1686 >> >> -manfred > > >-- >Justin (a/k/a jcc7) >http://jcc_7.tripod.com/d/ | |||
March 17, 2005 Re: Mixin strange behaviour (now it will be: guys on the forum make me feel home) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | In article <d1bb4u$5u0$2@digitaldaemon.com>, J C Calvarese says... > >Manfred Nowak wrote: >> Lox TG <Lox_member@pathlink.com> wrote: >> >> [...] >> >>>found something strange: >> >> [...] >> >> Would you please post here only if you are _sure_, that you are _not_ describing a bug. Otherwise send your posts to the digitalmars.bugs- NG please. > >Sometimes mere mortals don't know if it's a bug or not until after they post it. > >> There are similar posts already. For example: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/1686 >> >> -manfred > > >-- >Justin (a/k/a jcc7) >http://jcc_7.tripod.com/d/ Pardonez moi, mea culpa, mea maxima culpa. It seems that folks on this forum are very good at welcoming newbies. Anyone thought that I couldn't know if it is a bug or not? Maybe it is a rule "Do not use mixins' parametrized code with a linkage other than D", the docs on the site seems not to be always so specific to me (let's say that they're not the same as VC++ online help ;-)). It seemed to me that doing some investigation on this strange behaviour prior to bothering the guys at DM posting it as a bug on the dedicated forum (YES, I know that it exists and that there are similar posts on it, but you wrote right, SIMILAR, full stop. I've haven't found a bug post dealing woth Windows linkage in mixins). If you feel being bothered from SIMILAR question (Oh, what a crime) you have the right to ignore them. There's no reason to laugh at us "mere mortals", as you said (I'm wondering if it make you feel a REAL pro :-D). Still very impressed though. "When Rome will Fall Then the World" | |||
March 17, 2005 Re: Mixin strange behaviour (now it will be: guys on the forum make me feel home) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Lox TG | Lox TG <Lox_member@pathlink.com> wrote: [...] > I couldn't know if it is a bug or not? Maybe [...] > bothering the guys at DM posting it as a bug on the dedicated forum [...] This has nothing to do with you yourself declaring as a newbie to D. But rather with the rules of thumb existing in news groups: Using fake names is impolite. Using fake email adresses is impolite. Cross posting is impolite. Posting to general NG, if there is a dedicated NG, is impolite. Making wrong statements and not excusing is impolite. Beginning a new thread and not leading it is impolite. Beginning a new thread on nearly the same subject after a few days is impolite. People who start to flame, when they get a hint that they might not have followed the rules of thumb, are impolite. Impolite people are considered as spam and plonked or forwarded to clown groups. Decide yourself how you want your posts to be treated. -manfred | |||
March 17, 2005 Re: Mixin strange behaviour (now it will be: guys on the forum make me feel home) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | On Thu, 17 Mar 2005 11:30:36 +0000 (UTC), Manfred Nowak wrote: [snip] > Decide yourself how you want your posts to be treated. > > -manfred Do worry yourself too much over Manfred's enthusiasm; he's mostly harmless even though he comes across as a bit Teutonic at times. He sincerely means well, so don't take it personally. Me, however...I'm impolite, disrespectful to self-important people, and basically full of shit, IMNSHO ;-) So don't listen to my chaff and rubbish. -- Derek Parnell Melbourne, Australia http://www.dsource.org/projects/build 18/03/2005 12:51:29 AM | |||
March 17, 2005 Re: Mixin strange behaviour (now it will be: guys on the forum make me feel home) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | Firstable there's no rule page for this forum in the DM site, so all the beautiful things you wrote are only useless chars in a remote DB ;-) However: >Using fake names is impolite. I've taken a look in the forum and found that there's not only me using a NICKname, and it seems to be a normal thing to use a NICKname in forums, chats, newsgroups and mailinglists. >Using fake email adresses is impolite. Sorry but my account is just full of spam, don't wat any other :-) And it was not fake, just didn't entered it. >Cross posting is impolite. I'm used to PHPBB, this forum has a simpler but different interface, I made some confusion with the buttons but I'm managing to getting used to it, I know I can do it :-D >Posting to general NG, if there is a dedicated NG, is impolite. Oh God of the gods, will he never understand? I didn't know if it was a bug or not and seems to me very IMPOLITE to post as a bug without have ever asked someone else if he knows it is or not. ;-) >Making wrong statements and not excusing is impolite. You think that writing "Yo stupid guy, post this scrap elsewhere" without answering at the question is POLITE? And insulting people with things like "mere mortals"? I think not ;-) >Beginning a new thread and not leading it is impolite. Again, I'm getting used to this forum interface. >Beginning a new thread on nearly the same subject after a few days is impolite. If the server didn't blocked it, it means i can do it, and the new post was made 'cuz nearly noone replied (except You, if i'm not making a mistake, so thnx very much, but it was enough evident that it was not a problem of type definition, Win32 programming in D is still doable without importing the useless std.c.windows.windows module and the OPTLINK linker) and I had new clues about the problem, needed to attract your attention ;-) >People who start to flame, when they get a hint that >they might not have followed the rules of thumb, are impolite. People who continue to flame are IMPOLITE, aren't they? :-) >Impolite people are considered as spam and plonked or forwarded to clown groups. Ok, let's have a beer next time we'll meet to the circus for work, I'll pay for you too, OK? :-D >Decide yourself how you want your posts to be treated. I've decided, but you have to take a decision too, decide how you want to take care of new user of D, it could have consequencies on the language diffusion over time ;-) >Do not worry yourself too much over Manfred's enthusiasm Thnx Derek (can I call you Derek? I don't want to seem IMPOLITE ;-) ), but I'm not taking the risk :-) Stil very very impressed though. "When Rome will Fall Then the World" | |||
March 17, 2005 Re: Mixin strange behaviour (now it will be: guys on the forum make me feel home) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Lox TG | In article <d1c4mn$12ml$1@digitaldaemon.com>, Lox TG says... .. >You think that writing "Yo stupid guy, post this scrap elsewhere" without answering at the question is POLITE? And insulting people with things like "mere mortals"? I think not ;-) Please calm down a little. Manfred is obnoxious to everyone. Don't feel like you're be singled out. By the way, I was the guy wrote "mere mortals" and it was directed at Manfred--not you. I was hinting to him that we don't all consider ourselves to be programming gods, and he should cut the rest of us some slack. If it was insulting, it definitely wasn't meant to insulting to you (unless you consider yourself to be immortal, in which case I hope you have time to forgive all of us for the misunderstanding). jcc7 | |||
March 17, 2005 [OT] Re: Mixin strange behaviour (now it will be: guys on the forum make me feel home) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Lox TG | Lox TG <Lox_member@pathlink.com> wrote:
> Firstable there's no rule page for this forum in the DM site, so all the beautiful things you wrote are only useless chars in a remote DB ;-)
[...]
I see. Could it be that you are one of these guys who need signs on the walls everywhere?
Do you frequently notice, that people stand up and leave when you just sat down?
Do you frequently notice, that when you greet people on the road, they do not greet back?
Can it be that, if one day somebody will not stand up or will greet back and in addition remarks that incredible body smell makes people lonely, you would bark at him, that there are no signs at the wall that disallow you to have body smell?
You are welcome to do what you like, iff you accept that others also do what they like.
-manfred
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply