D - Conflicting argument types that don't conflict?
- J C Calvarese <jcc7 cox.net> Apr 07 2004
- Dave Sieber <dsieber spamnot.sbcglobal.net> Apr 07 2004
- J C Calvarese <jcc7 cox.net> Apr 07 2004
- "Derek Parnell" <Derek.Parnell psyc.ward> Apr 07 2004
- J C Calvarese <jcc7 cox.net> Apr 07 2004
- "Phill" <phill pacific.net.au> Apr 08 2004
- J C Calvarese <jcc7 cox.net> Apr 13 2004
- "Walter" <newshound digitalmars.com> Oct 25 2004
- J C Calvarese <jcc7 cox.net> Oct 25 2004
I've got an error message that I wish was more helpful. I wonder if
anyone has run into a similar problem before (and found a solution).
direct.d(548): function Blt (tagRECT *,IDirectDrawSurface ,tagRECT
*,uint,DDBLTFX *) does not match argument types (tagRECT
*,IDirectDrawSurface ,tagRECT *,uint,DDBLTFX *)
Allow me to break it down:
(tagRECT *,IDirectDrawSurface ,tagRECT *,uint,DDBLTFX *)
|| || || || ||
(tagRECT *,IDirectDrawSurface ,tagRECT *,uint,DDBLTFX *)
They look to be identical to me.
I think the problem might be interface-related (Blt is defined in an
interface), but I'm unsure what exactly the problem is. The code is
spread across several modules, so that is probably part of the problem.
It's possible that the data types are defined in different places with
slightly different definitions, but this code used to compile so I do
suspect a subtle compiler bug. I'll probably try to put together a bug
report, but it'll probably take some time to pare it down and I'm not
looking forward to it.
--
Justin
http://jcc_7.tripod.com/d/
Apr 07 2004
J C Calvarese <jcc7 cox.net> wrote:I've got an error message that I wish was more helpful. I wonder if anyone has run into a similar problem before (and found a solution).
Yes, I had this same thing, and I was puzzled for a while. It turned out that there was an overload of the function (with different arguments) somewhere else, and I had to qualify the function call, either with the explicit module name, or with '.', as in ".printf()". I'm sorry I don't have the details -- I fixed it and moved on. But one of the above should resolve it. It was something that bothered me, as I really felt it should have worked as written. It was "unintuitive" (as it seems to be for you too) because I had to sit down and try to figure out the reasoning behind the error. -- dave
Apr 07 2004
Dave Sieber wrote:J C Calvarese <jcc7 cox.net> wrote:I've got an error message that I wish was more helpful. I wonder if anyone has run into a similar problem before (and found a solution).
Yes, I had this same thing, and I was puzzled for a while. It turned out that there was an overload of the function (with different arguments) somewhere else, and I had to qualify the function call, either with the explicit module name, or with '.', as in ".printf()". I'm sorry I don't have the details -- I fixed it and moved on. But one of the above should resolve it.
That's how I treat errors that I fix, too: problem solved, case closed. Thanks for the suggestion. I can only find one Blt, though. And I think I've casted everything that I can cast and it still doesn't work. /* from win32\directx\directdraw.d */ interface IDirectDrawSurface : IUnknown { /*** IUnknown methods ***/ // HRESULT QueryInterface( REFIID riid, LPVOID * ppvObj); // ULONG AddRef(); // ULONG Release(); /*** IDirectDrawSurface methods ***/ HRESULT AddAttachedSurface( LPDIRECTDRAWSURFACE ); HRESULT AddOverlayDirtyRect( LPRECT ); HRESULT Blt( LPRECT,LPDIRECTDRAWSURFACE, LPRECT,DWORD, LPDDBLTFX ); HRESULT BltBatch( LPDDBLTBATCH, DWORD, DWORD ); HRESULT BltFast( DWORD,DWORD,LPDIRECTDRAWSURFACE, LPRECT,DWORD ); HRESULT DeleteAttachedSurface( DWORD,LPDIRECTDRAWSURFACE ); // other methods ... } /* from win32\directx\direct.d */ primSurface.Blt(cast(jcc7.win32.wtypes.tagRECT*) &destination, cast(IDirectDrawSurface) backingSurface, cast(tagRECT*) &source, cast(uint) DDBLT_WAIT, cast(DDBLTFX*) null ); By the way, I'm working with code that I downloaded rather than stuff I've written myself from scratch, so there's a reasonable chance that I just don't know what I'm doing. :)It was something that bothered me, as I really felt it should have worked as written. It was "unintuitive" (as it seems to be for you too) because I had to sit down and try to figure out the reasoning behind the error.
-- Justin http://jcc_7.tripod.com/d/
Apr 07 2004
On Wed, 07 Apr 2004 19:23:31 -0500 (08/Apr/04 10:23:31 AM) , J C Calvarese <jcc7 cox.net> wrote:Dave Sieber wrote:J C Calvarese <jcc7 cox.net> wrote:I've got an error message that I wish was more helpful. I wonder if anyone has run into a similar problem before (and found a solution).
out that there was an overload of the function (with different arguments) somewhere else, and I had to qualify the function call, either with the explicit module name, or with '.', as in ".printf()". I'm sorry I don't have the details -- I fixed it and moved on. But one of the above should resolve it.
That's how I treat errors that I fix, too: problem solved, case closed. Thanks for the suggestion. I can only find one Blt, though. And I think I've casted everything that I can cast and it still doesn't work.
Can you rename the Blt function you found. If there is only one, then references to it should fail with an unknown function message. -- Derek
Apr 07 2004
Derek Parnell wrote:On Wed, 07 Apr 2004 19:23:31 -0500 (08/Apr/04 10:23:31 AM) , J C Calvarese <jcc7 cox.net> wrote:Dave Sieber wrote:J C Calvarese <jcc7 cox.net> wrote:I've got an error message that I wish was more helpful. I wonder if anyone has run into a similar problem before (and found a solution).
Yes, I had this same thing, and I was puzzled for a while. It turned out that there was an overload of the function (with different arguments) somewhere else, and I had to qualify the function call, either with the explicit module name, or with '.', as in ".printf()". I'm sorry I don't have the details -- I fixed it and moved on. But one of the above should resolve it.
That's how I treat errors that I fix, too: problem solved, case closed. Thanks for the suggestion. I can only find one Blt, though. And I think I've casted everything that I can cast and it still doesn't work.
Can you rename the Blt function you found. If there is only one, then references to it should fail with an unknown function message.
Good idea. If I change the one in directdraw, I get this: direct.d(548): no property 'Blt' for type 'IDirectDrawSurface' I think there's only one Blt function. Perhaps I found an interface bug. Thanks for your help. -- Justin http://jcc_7.tripod.com/d/
Apr 07 2004
I had a very similar problem when trying to connect with a socket. I was calling the fuction correctly, but I was getting the same error as you. Being a novice, after a week I gave up on it, and downloaded Vathix's socket.d and associated files. Problem solved ! :o)) Phill. "J C Calvarese" <jcc7 cox.net> wrote in message news:c521m3$1j8k$1 digitaldaemon.com...I've got an error message that I wish was more helpful. I wonder if anyone has run into a similar problem before (and found a solution). direct.d(548): function Blt (tagRECT *,IDirectDrawSurface ,tagRECT *,uint,DDBLTFX *) does not match argument types (tagRECT *,IDirectDrawSurface ,tagRECT *,uint,DDBLTFX *) Allow me to break it down: (tagRECT *,IDirectDrawSurface ,tagRECT *,uint,DDBLTFX *) || || || || || (tagRECT *,IDirectDrawSurface ,tagRECT *,uint,DDBLTFX *) They look to be identical to me. I think the problem might be interface-related (Blt is defined in an interface), but I'm unsure what exactly the problem is. The code is spread across several modules, so that is probably part of the problem. It's possible that the data types are defined in different places with slightly different definitions, but this code used to compile so I do suspect a subtle compiler bug. I'll probably try to put together a bug report, but it'll probably take some time to pare it down and I'm not looking forward to it. -- Justin http://jcc_7.tripod.com/d/
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004
Apr 08 2004
Phill wrote:I had a very similar problem when trying to connect with a socket. I was calling the fuction correctly, but I was getting the same error as you. Being a novice, after a week I gave up on it, and downloaded Vathix's socket.d and associated files. Problem solved ! :o)) Phill.
I finally hammered my problem down to a couple of files. I think my problem is caused by the necessary types being defined in the private scope in each file. I guess I know how to *solve* it, but I still wonder whether it's an *error* or a *bug*. If it's an error, I'd like to understand what's actually wrong with the code. How I compile it: dmd direct.d -c Here's my error message: direct.d(25): function Blt (tagRECT *,IDirectDrawSurface ,tagRECT *,uint,DDBLTFX *) does not match argument types (tagRECT *,IDirectDrawSurface ,tagRECT *,uint,DDBLTFX *) /* *** *** directdraw.d *** *** */ module directdraw; private { alias int HRESULT; alias uint DWORD; struct tagRECT{} alias tagRECT* LPRECT; } extern(Windows) { alias IDirectDrawSurface LPDIRECTDRAWSURFACE; struct DDBLTFX{} interface IDirectDrawSurface { HRESULT Blt(LPRECT, LPDIRECTDRAWSURFACE, LPRECT, DWORD, DDBLTFX*); } } enum: uint { DDBLT_WAIT = 0x01000000 } /* *** *** direct.d *** *** */ module direct; private import directdraw; private { struct tagRECT{} alias tagRECT RECT; alias tagRECT* LPRECT; } class DirectApp { IDirectDrawSurface primSurface; IDirectDrawSurface backingSurface; public this(){} public void updatePrimarySurface() { RECT source; RECT destination; primSurface.Blt( cast(tagRECT*) &destination, /* line 25 */ cast(IDirectDrawSurface) backingSurface, cast(tagRECT*) &source, cast(uint) DDBLT_WAIT, cast(DDBLTFX*) null ); } } -- Justin http://jcc_7.tripod.com/d/
Apr 13 2004
The problem is that the function linkage types don't match. Deriving from IUnknown makes it an extern (Windows) function linkage, which doesn't match the default extern (D) linkage. "J C Calvarese" <jcc7 cox.net> wrote in message news:c5ig16$4lp$1 digitaldaemon.com...Phill wrote:I had a very similar problem when trying to connect with a socket. I was calling the fuction correctly, but I was getting the same error as you. Being a novice, after a week I gave up on it, and downloaded Vathix's socket.d and associated files. Problem solved ! :o)) Phill.
I finally hammered my problem down to a couple of files. I think my problem is caused by the necessary types being defined in the private scope in each file. I guess I know how to *solve* it, but I still wonder whether it's an *error* or a *bug*. If it's an error, I'd like to understand what's actually wrong with the code. How I compile it: dmd direct.d -c Here's my error message: direct.d(25): function Blt (tagRECT *,IDirectDrawSurface ,tagRECT *,uint,DDBLTFX *) does not match argument types (tagRECT *,IDirectDrawSurface ,tagRECT *,uint,DDBLTFX *) /* *** *** directdraw.d *** *** */ module directdraw; private { alias int HRESULT; alias uint DWORD; struct tagRECT{} alias tagRECT* LPRECT; } extern(Windows) { alias IDirectDrawSurface LPDIRECTDRAWSURFACE; struct DDBLTFX{} interface IDirectDrawSurface { HRESULT Blt(LPRECT, LPDIRECTDRAWSURFACE, LPRECT, DWORD, DDBLTFX*); } } enum: uint { DDBLT_WAIT = 0x01000000 } /* *** *** direct.d *** *** */ module direct; private import directdraw; private { struct tagRECT{} alias tagRECT RECT; alias tagRECT* LPRECT; } class DirectApp { IDirectDrawSurface primSurface; IDirectDrawSurface backingSurface; public this(){} public void updatePrimarySurface() { RECT source; RECT destination; primSurface.Blt( cast(tagRECT*) &destination, /* line 25 */ cast(IDirectDrawSurface) backingSurface, cast(tagRECT*) &source, cast(uint) DDBLT_WAIT, cast(DDBLTFX*) null ); } } -- Justin http://jcc_7.tripod.com/d/
Oct 25 2004
Walter wrote:The problem is that the function linkage types don't match. Deriving from IUnknown makes it an extern (Windows) function linkage, which doesn't match the default extern (D) linkage.
Ah, well, I suppose that would explain it. I'll look for that next time. Too bad the error message doesn't mention the function linkage in particular. ;) Thanks for the tip."J C Calvarese" <jcc7 cox.net> wrote in message news:c5ig16$4lp$1 digitaldaemon.com...
-- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Oct 25 2004









J C Calvarese <jcc7 cox.net> 