I just started playing with the latest Objects.inc and the Oop generator. Then I plugged my new object (I had made no changes to it yet) into a template ASM project. I compiled it... and presto! Errors!

Any idea as to what is causing this?



Assembling: wsobjects.asm
SOCKET.asm(40) : error A2008: syntax error : STRUC
CLASS(9): Macro Called From
SOCKET.asm(40): Include File
SOCKET.asm(41) : error A2034: must be in segment block
CMETHOD(4): Macro Called From
SOCKET.asm(41): Include File
SOCKET.asm(42) : error A2034: must be in segment block
CMETHOD(4): Macro Called From
SOCKET.asm(42): Include File
SOCKET.asm(43) : error A2034: must be in segment block
CMETHOD(4): Macro Called From
SOCKET.asm(43): Include File
SOCKET.asm(44) : error A2034: must be in segment block
CMETHOD(4): Macro Called From
SOCKET.asm(44): Include File
SOCKET.asm(45) : error A2034: must be in segment block
CMETHOD(4): Macro Called From
SOCKET.asm(45): Include File
SOCKET.asm(46) : error A2034: must be in segment block
SOCKET.asm(47) : error A2034: must be in segment block
SOCKET.asm(48) : error A2034: must be in segment block
SOCKET.asm(49) : error A2034: must be in segment block
SOCKET.asm(50) : error A2034: must be in segment block
SOCKET.asm(51) : error A2008: syntax error : ENDS

###########
# Warning # SOCKET size differs from initialized size
###########


Make error(s) occured.


All this happened in this piece of code:



CLASS SOCKET, SOCK
CMETHOD destructor ; MUST BE THE FIRST, OR OBJECTS.INC WILL FAIL
CMETHOD FreeLine
CMETHOD GetLine
CMETHOD Receive
CMETHOD Send
BufferSize dd ?
BufferUsed dd ?
hSock dd ?
LastLineLen dd ?
pBuffer dd ?
SOCKET ENDS

Posted on 2002-06-28 04:27:02 by Qweerdy
Hmm I think this line in windows.inc causes all the trouble:


SOCKET TYPEDEF DWORD


:grin:

Thomas
Posted on 2002-06-28 05:12:50 by Thomas
Doh! Thanks for that :)

:stupid:
Posted on 2002-06-28 06:11:58 by Qweerdy
Heh ;)

I dunno if i would have seen that... good job Thomas.


Qweerdy, hope you like it and feel free to give feedback on what you dont :alright:

:NaN:
Posted on 2002-06-30 04:05:42 by NaN
Yes, I like it! It's kind of like inline C in ASM instead of the other way around :)
Especially for network coding I'm starting to find it very useful...



.while TRUE
; Show off the cool accelerated method calling. Note that if the socket was closed, GetLine
; returns NULL. MessageBox supports NULL pointers, but your functions may not.
invoke MessageBox,0,$EBX(hRecv,SOCKET,GetLine),0,MB_OK
.if ebx==0
Err "SOCKET.GetLine failed. Connection closed?"
.break
.endif
; Show why FreeLine returns the last line length (it clears SOCKET.LastLineLen on exit)
.if $EBX(hRecv,SOCKET,FreeLine)<=2 ; If it was an empty line
Err "Empty line! We'll now receive 7 bytes with SOCKET.Receive"
; Shows using the return value multiple times in an IF statement
; Also note that SOCKET.Receive has the same parameters as the winsock "recv" API,
; except the new MSG_COMPLETE flag can now be specified in "Flags".
.if ($EBX(hRecv,SOCKET,Receive,offset buffer,sizeof buffer-1,MSG_COMPLETE)!=0) && (ebx!=INVALID_SOCKET)
; This zero-terminates the buffer. This could also be done once before the loop as
; a simple "mov buffer[sizeof buffer-1],0" since we specified MSG_COMPLETE, so if the
; function succeeded it will always return 7 bytes.
mov byte ptr [buffer+ebx],0
invoke MessageBox,0,addr buffer,0,MB_OK
.else
Err "SOCKET.Receive failed. Connection closed?"
.break
.endif
.endif
.endw
Posted on 2002-06-30 05:31:34 by Qweerdy
Thats what Thomas tells me too ;)

Have fun..
:alright:
NaN
Posted on 2002-06-30 15:05:54 by NaN