View mode: basic / threaded / horizontal-split · Log in · Help
March 17, 2005
D version fails to compile
I just downloaded the D version and used DMD v0.118 to compile it. I get a
lot of errors. And if I use the -w switch there are masses of warnings -
some I note are hiding potential bugs too.

The one error that has stopped me is ...

function std.c.windows.windows.DialogBoxParamA
(HANDLE,char*,HANDLE,int(Windows *)(HANDLE,uint,uint,int),int) does not
match argument types (HANDLE,char[7],HANDLE,int(Windows *)(),int)

The source line in question reads ....

DialogBoxParamA(global.hinst, "InitBox", hwnd, global.lpfnInitDlgProc, 0);

and 'lpfnInitDlgProc' is defined as ...

   FARPROC lpfnInitDlgProc ;

and in std.c.windows.d we find ...

   alias int (*FARPROC)();

Any clues?

-- 
Derek
Melbourne, Australia
17/03/2005 11:43:24 AM
March 17, 2005
Re: D version fails to compile
"Derek Parnell" <derek@psych.ward> wrote in message
news:1m0cgyfsaq60e$.70nc0ei00gbc$.dlg@40tude.net...
> function std.c.windows.windows.DialogBoxParamA
> (HANDLE,char*,HANDLE,int(Windows *)(HANDLE,uint,uint,int),int) does not
> match argument types (HANDLE,char[7],HANDLE,int(Windows *)(),int)
>
> The source line in question reads ....
>
> DialogBoxParamA(global.hinst, "InitBox", hwnd, global.lpfnInitDlgProc, 0);
>
> and 'lpfnInitDlgProc' is defined as ...
>
>     FARPROC lpfnInitDlgProc ;
>
> and in std.c.windows.d we find ...
>
>     alias int (*FARPROC)();
>
> Any clues?

Just cast it to the right value. I uploaded a new set of sources that
compiles.
March 17, 2005
Re: D version fails to compile
On Wed, 16 Mar 2005 20:08:09 -0800, Walter wrote:

> "Derek Parnell" <derek@psych.ward> wrote in message
> news:1m0cgyfsaq60e$.70nc0ei00gbc$.dlg@40tude.net...
>> function std.c.windows.windows.DialogBoxParamA
>> (HANDLE,char*,HANDLE,int(Windows *)(HANDLE,uint,uint,int),int) does not
>> match argument types (HANDLE,char[7],HANDLE,int(Windows *)(),int)
>>
>> The source line in question reads ....
>>
>> DialogBoxParamA(global.hinst, "InitBox", hwnd, global.lpfnInitDlgProc, 0);
>>
>> and 'lpfnInitDlgProc' is defined as ...
>>
>>     FARPROC lpfnInitDlgProc ;
>>
>> and in std.c.windows.d we find ...
>>
>>     alias int (*FARPROC)();
>>
>> Any clues?
> 
> Just cast it to the right value. I uploaded a new set of sources that
> compiles.

Well that was about as useful as tits of a bull! Of course one has to fix
it to have the 'right' value. But it isn't clear to all and sundry what
that actually would entail. 

I can see that what you have done is added ...

extern (Windows)
{
   alias int function(HANDLE, uint, uint, int) DLGPROC;
}


and changed ...
	FARPROC lpfnInitDlgProc ;
to ...
	DLGPROC lpfnInitDlgProc ;

Just in case you hadn't guessed, that was not an obvious solution to me. 

I take it that the two lines below are equivalent.

   alias int function(HANDLE, uint, uint, int) DLGPROC;
   alias int (*DLGPROC)(HANDLE, uint, uint, int);

I'm guessing the first is the D style and the second is the old C style. I
prefer the D style - it is much more clearer to read and understand.

I would have twigged if the original alias had have been coded as ...

  alias int function() FARPROC;


Anyhow, I made this addition below to empire.d and ran the latest (not
released yet) version of build and it built it without fuss - no makefile
required.

   version(build) {
       pragma(link, "winmm.lib");
       pragma(link, "comdlg32.lib");
       pragma(target, "winemp.exe");
       pragma(build, "empire.rc");
       pragma(main, "winmain.d");
   }

then used ...
 build empire


By the way, empire.rc refers to cursor.bmp and empire.ico which are not in
the distro.


-- 
Derek
Melbourne, Australia
17/03/2005 5:47:27 PM
March 17, 2005
Re: D version fails to compile
"Derek Parnell" <derek@psych.ward> wrote in message
news:1wre2w8kjo9s3.15hsamftw8lmi.dlg@40tude.net...
> On Wed, 16 Mar 2005 20:08:09 -0800, Walter wrote:
>
> > "Derek Parnell" <derek@psych.ward> wrote in message
> >> Any clues?
> >
> > Just cast it to the right value. I uploaded a new set of sources that
> > compiles.
>
> Well that was about as useful as tits of a bull! Of course one has to fix
> it to have the 'right' value. But it isn't clear to all and sundry what
> that actually would entail.

Sorry about that.

> I can see that what you have done is added ...
>
> extern (Windows)
> {
>     alias int function(HANDLE, uint, uint, int) DLGPROC;
> }
>
>
> and changed ...
> FARPROC lpfnInitDlgProc ;
> to ...
> DLGPROC lpfnInitDlgProc ;
>
> Just in case you hadn't guessed, that was not an obvious solution to me.

A cast would have worked too, in the same manner that C tends to rely on
typedef's to cast function pointer types, but I thought changing FARPROC to
DLGPROC looked a bit nicer.

> I take it that the two lines below are equivalent.
>
>     alias int function(HANDLE, uint, uint, int) DLGPROC;
>     alias int (*DLGPROC)(HANDLE, uint, uint, int);
>
> I'm guessing the first is the D style and the second is the old C style.

That's right, though D will accept the C style.

> I
> prefer the D style - it is much more clearer to read and understand.

So do I.

> I would have twigged if the original alias had have been coded as ...
>
>    alias int function() FARPROC;
>
>
> Anyhow, I made this addition below to empire.d and ran the latest (not
> released yet) version of build and it built it without fuss - no makefile
> required.
>
>     version(build) {
>         pragma(link, "winmm.lib");
>         pragma(link, "comdlg32.lib");
>         pragma(target, "winemp.exe");
>         pragma(build, "empire.rc");
>         pragma(main, "winmain.d");
>     }
>
> then used ...
>   build empire
>
>
> By the way, empire.rc refers to cursor.bmp and empire.ico which are not in
> the distro.

Thanks. It's fixed now.
March 18, 2005
Re: D version fails to compile
Walter wrote:
<snip>
> Just cast it to the right value. I uploaded a new set of sources that
> compiles.

I've just downloaded the source, and can't find any of the numerous bug 
fixes I sent you a while ago.  Did you lose my fixed version, or did I 
mistake your question

> Cool! And just to reiterate, these changes are donated?

for being rhetorical?

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.
March 18, 2005
Re: D version fails to compile
"Stewart Gordon" <smjg_1998@yahoo.com> wrote in message
news:d1eil5$qec$1@digitaldaemon.com...
> Walter wrote:
> <snip>
> > Just cast it to the right value. I uploaded a new set of sources that
> > compiles.
>
> I've just downloaded the source, and can't find any of the numerous bug
> fixes I sent you a while ago.  Did you lose my fixed version, or did I
> mistake your question
>
>  > Cool! And just to reiterate, these changes are donated?
>
> for being rhetorical?

I didn't look at them yet as I hadn't seen a reply yet on the copyright
status of the changes. It's nice to make sure all the t's are crossed and
i's are dotted for the copyright issues.
March 21, 2005
Re: D version fails to compile
Walter wrote:
> "Stewart Gordon" <smjg_1998@yahoo.com> wrote in message 
> news:d1eil5$qec$1@digitaldaemon.com...
> 
>> Walter wrote: <snip>
>> 
>>> Just cast it to the right value. I uploaded a new set of sources
>>> that compiles.
>> 
>> I've just downloaded the source, and can't find any of the numerous
>> bug fixes I sent you a while ago.  Did you lose my fixed version,
>> or did I mistake your question
>> 
>>> Cool! And just to reiterate, these changes are donated?
>> 
>> for being rhetorical?
> 
> I didn't look at them yet as I hadn't seen a reply yet on the
> copyright status of the changes. It's nice to make sure all the t's
> are crossed and i's are dotted for the copyright issues.

Rest assured the changes are free for you to do whatever you want - 
check in to the official version, claim whatever level of IPR you wish....

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on
the 'group where everyone may benefit.
March 24, 2005
Re: D version fails to compile
"Stewart Gordon" <smjg_1998@yahoo.com> wrote in message
news:d1manb$2olp$1@digitaldaemon.com...
> Rest assured the changes are free for you to do whatever you want -
> check in to the official version, claim whatever level of IPR you wish....

Thanks!
Top | Discussion index | About this forum | D home