I wrote:
> The fpc bug report without using any classes or synapse and just BeginThread
> seems to have same behavior.
> As soon as I comment out all the thread code and run it is a regular non
> threaded app, it reports error back correctly. In delphi 5, works fine either
> way, with or without threads.
Ahhh.. but now I have finally got WSAGetLastError to work in a thread using
freepascal sockets unit along with winsock2 and BeginThread simple calls..
Somehow WriteLn with freepascal in a thread resets WSAGetLastError..
Writeln('This Resets it ', WSAGetLastError);
Whereas:
var tmp: integer;
begin
tmp:= WSAGetLastError();
Writeln('This shows error ', tmp);
end;
In other words, delphi writeln does not seem to reset wsagetlasterror whereas
freepascal writeln does.
As for Synapse...
I haven't gotten there yet.. just was doing simple freepascal sockets.pp code
today.
Synapse stores the WSAGetLastError in LastError public class variable..
So...... Now I have to see if synapse will somehow reset WSAGetLastError
first... not through a writeln as far as I know, since synpse doesn't call
writeln.. so.. some other function maybe.
I think WSAGetLastError is hooked up to the GetLastError function internally..
so anything that calls SetLastError in the WinAPI (which freepascal writeln must
do) resets WSAGetLastError in addition to GetLastError.
L505
Happy, and Mad at WSAGetLastError.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public