[fpc-pascal] Re: WSAGetLastError returns 0 when it shouldn't but I cannot see why

L L at z505.com
Thu Feb 28 04:51:49 CET 2008

L wrote:
> Luca wrote:
>> I don't think that synapse is to blame[*]: my test
>> program is also using the sockets unit directly, and stores SocketError
>> (which just calls WSAGetLastError) in a variable.
> Found the problem using my brute force writeln('') skills. It is an 
> issue with freepascal's stack or something to do with buggy threads 
> methinks. As it is when you call lasterror within another procedure 
> with local variables.. they are corrupted or something.
Aha.. I changed the by Value parameter to a CONST parameter in the error 
procedure (Perror).. And this solves the issue..

So something to do with calling by Value within a thread versus a const 

I will attach the problem in the bug report previously opened if I can 
reopen it.

More information about the fpc-pascal mailing list