digitalmars.D.learn - Compiler not recognizing certain structs, types?
- V (30/30) Apr 21 2005 I'm getting weird errors from the compiler about certain win32 types
- Manfred Nowak (4/6) Apr 21 2005 You may want to check your source for multiple typedef's of `WSABUF'.
- V (7/18) Apr 21 2005 After some searching I found this:
- V (10/36) Apr 21 2005 Upon removing all LP types to type* and commented the alias', the
- MicroWizard (6/42) Apr 25 2005 I understand your problems with weird type resolution in D,
- jicman (4/6) Apr 28 2005 I agree. I've written a few applications using the Phobos socket librar...
- V (8/19) Apr 21 2005 After some searching I found this:
- Derek Parnell (11/51) Apr 21 2005 In some ways, DMD is fairly simple minded. Your code fails because the
I'm getting weird errors from the compiler about certain win32 types that I have to declare like: alias void (* LPWSAOVERLAPPED_COMPLETION_ROUTINE)(in DWORD, in DWORD, in LPWSAOVERLAPPED, in DWORD); Then import certain functions like: extern(Windows) { int WSASend(SOCKET s, LPWSABUF, DWORD, LPDWORD, DWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); } And the error happens here: if (WSASend(client.socket, &buffer, 1, &sent, 0, &client.sendoverlapped, &sendCompletion) && WSAGetLastError() != WSA_IO_PENDING) Errors: function network.WSASend (uint,WSABUF *,uint,uint*,uint,WSAOVERLAPPED *,int(Windows *)(HANDLE,uint,uint,int)) does not match argument types (uint,WSABUF *,int,uint*,int,WSAOVERLAPPED *,void(Windows *)(uint dwError,uint cbTransferred,WSAOVERLAPPED *lpOverlapped,uint dwFlags)) cannot implicitly convert expression (#buffer) of type WSABUF * to WSABUF * WSAOVERLAPPED * to WSAOVERLAPPED * cannot implicitly convert expression (#SendCompletion) of type void(Windows *)(uint dwError,uint cbTransferred,WSAOVERLAPPED *lpOverlapped,uint dwFlags) to void(Windows *)(uint,uint,WSAOVERLAPPED *,uint)
Apr 21 2005
V <v pathlink.com> wrote: [...]cannot implicitly convert expression (#buffer) of type WSABUF * to WSABUF *You may want to check your source for multiple typedef's of `WSABUF'. -manfred
Apr 21 2005
After some searching I found this: alias WSABUF* LPWSABUF; I commented that out and changed all instances of LPWSABUF with WSABUF* and magically that error disappeared, but the other 3 remain. :( :confused: Manfred Nowak wrote:V <v pathlink.com> wrote: [...]cannot implicitly convert expression (#buffer) of type WSABUF * to WSABUF *You may want to check your source for multiple typedef's of `WSABUF'. -manfred
Apr 21 2005
Upon removing all LP types to type* and commented the alias', the problems disappear. These alias' are bad, mmmkay: alias WSAOVERLAPPED* LPWSAOVERLAPPED; alias WSABUF* LPWSABUF; alias void (* LPWSAOVERLAPPED_COMPLETION_ROUTINE)(in DWORD, in DWORD, in LPWSAOVERLAPPED, in DWORD); So why is DMD choking on those aliased types? Are these incorrect? Thanks :-B V wrote:After some searching I found this: alias WSABUF* LPWSABUF; I commented that out and changed all instances of LPWSABUF with WSABUF* and magically that error disappeared, but the other 3 remain. :( :confused: Manfred Nowak wrote:V <v pathlink.com> wrote: [...]cannot implicitly convert expression (#buffer) of type WSABUF * to WSABUF *You may want to check your source for multiple typedef's of `WSABUF'. -manfred
Apr 21 2005
I understand your problems with weird type resolution in D, maybe the time will make it cleaner... I hope... But. Why do you use WSA... thing for sockets? There is a solid socket (and socketstream) implementation in Phobos. Tamas Nagy In article <d49vvu$1j2l$1 digitaldaemon.com>, V says...Upon removing all LP types to type* and commented the alias', the problems disappear. These alias' are bad, mmmkay: alias WSAOVERLAPPED* LPWSAOVERLAPPED; alias WSABUF* LPWSABUF; alias void (* LPWSAOVERLAPPED_COMPLETION_ROUTINE)(in DWORD, in DWORD, in LPWSAOVERLAPPED, in DWORD); So why is DMD choking on those aliased types? Are these incorrect? Thanks :-B V wrote:After some searching I found this: alias WSABUF* LPWSABUF; I commented that out and changed all instances of LPWSABUF with WSABUF* and magically that error disappeared, but the other 3 remain. :( :confused: Manfred Nowak wrote:V <v pathlink.com> wrote: [...]cannot implicitly convert expression (#buffer) of type WSABUF * to WSABUF *You may want to check your source for multiple typedef's of `WSABUF'. -manfred
Apr 25 2005
In article <d4js5e$2uo7$1 digitaldaemon.com>, MicroWizard says...But. Why do you use WSA... thing for sockets? There is a solid socket (and socketstream) implementation in Phobos.I agree. I've written a few applications using the Phobos socket libraries and they have worked perfectly. jic
Apr 28 2005
After some searching I found this: alias WSABUF* LPWSABUF; I commented that out and changed all instances of LPWSABUF with WSABUF* and magically that error disappeared, but the other 3 remain. Thanks for the help! :( :confused: Manfred Nowak wrote:V <v pathlink.com> wrote: [...]cannot implicitly convert expression (#buffer) of type WSABUF * to WSABUF *You may want to check your source for multiple typedef's of `WSABUF'. -manfred
Apr 21 2005
On Thu, 21 Apr 2005 20:30:04 -0700, V wrote:I'm getting weird errors from the compiler about certain win32 types that I have to declare like: alias void (* LPWSAOVERLAPPED_COMPLETION_ROUTINE)(in DWORD, in DWORD, in LPWSAOVERLAPPED, in DWORD); Then import certain functions like: extern(Windows) { int WSASend(SOCKET s, LPWSABUF, DWORD, LPDWORD, DWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); } And the error happens here: if (WSASend(client.socket, &buffer, 1, &sent, 0, &client.sendoverlapped, &sendCompletion) && WSAGetLastError() != WSA_IO_PENDING) Errors: function network.WSASend (uint,WSABUF *,uint,uint*,uint,WSAOVERLAPPED *,int(Windows *)(HANDLE,uint,uint,int)) does not match argument types (uint,WSABUF *,int,uint*,int,WSAOVERLAPPED *,void(Windows *)(uint dwError,uint cbTransferred,WSAOVERLAPPED *lpOverlapped,uint dwFlags)) cannot implicitly convert expression (#buffer) of type WSABUF * to WSABUF * WSAOVERLAPPED * to WSAOVERLAPPED * cannot implicitly convert expression (#SendCompletion) of type void(Windows *)(uint dwError,uint cbTransferred,WSAOVERLAPPED *lpOverlapped,uint dwFlags) to void(Windows *)(uint,uint,WSAOVERLAPPED *,uint)In some ways, DMD is fairly simple minded. Your code fails because the literal '1' is believed by DMD to be an 'int', but the type DWORD is a 'uint', so DMD complains. If you change the call literal to '1U' all will be well again. Why DMD can't work out that if the literal as an int doesn't match, it can retry to match assuming that the literal is a uint, I haven't got a clue. -- Derek Melbourne, Australia 22/04/2005 2:07:34 PM
Apr 21 2005
I tried '1U' with no luck, all those errors still appear. :( Derek Parnell wrote:On Thu, 21 Apr 2005 20:30:04 -0700, V wrote:I'm getting weird errors from the compiler about certain win32 types that I have to declare like: alias void (* LPWSAOVERLAPPED_COMPLETION_ROUTINE)(in DWORD, in DWORD, in LPWSAOVERLAPPED, in DWORD); Then import certain functions like: extern(Windows) { int WSASend(SOCKET s, LPWSABUF, DWORD, LPDWORD, DWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); } And the error happens here: if (WSASend(client.socket, &buffer, 1, &sent, 0, &client.sendoverlapped, &sendCompletion) && WSAGetLastError() != WSA_IO_PENDING) Errors: function network.WSASend (uint,WSABUF *,uint,uint*,uint,WSAOVERLAPPED *,int(Windows *)(HANDLE,uint,uint,int)) does not match argument types (uint,WSABUF *,int,uint*,int,WSAOVERLAPPED *,void(Windows *)(uint dwError,uint cbTransferred,WSAOVERLAPPED *lpOverlapped,uint dwFlags)) cannot implicitly convert expression (#buffer) of type WSABUF * to WSABUF * WSAOVERLAPPED * to WSAOVERLAPPED * cannot implicitly convert expression (#SendCompletion) of type void(Windows *)(uint dwError,uint cbTransferred,WSAOVERLAPPED *lpOverlapped,uint dwFlags) to void(Windows *)(uint,uint,WSAOVERLAPPED *,uint)In some ways, DMD is fairly simple minded. Your code fails because the literal '1' is believed by DMD to be an 'int', but the type DWORD is a 'uint', so DMD complains. If you change the call literal to '1U' all will be well again. Why DMD can't work out that if the literal as an int doesn't match, it can retry to match assuming that the literal is a uint, I haven't got a clue.
Apr 21 2005