[Lazarus] WinINet STDCALL callback crash
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Sat Feb 23 23:59:23 CET 2013
matthew at accordancebible.com schrieb:
> Hello Lazarus Community,
>
> I am implementing asynchronous file download using WinINet's STDCALL
> callback. However, when the callback function recursively calls
> itself, it generates a crash around fpc_popaddrstack.
Recursive asynchronous calls deserve special handling. They should be
avoided in the first place, nowadays *threads* can be used instead.
> I hypothesize
> that Pascal does not understand how to handle callbacks that use the
> stdcall convention (which I must use since the callback interfaces
> with the Win32 API and is itself set via the Win32 WinINet procedure
> InternetSetStatusCallback).
This IMO is not a language problem, but misuse of asynchronous processing.
> I was wondering if anyone might graciously offer guidance on how to
> implement asynchronous download to file using the Win32 API or
> associated libraries only.
I'd suggest to move the download into an thread, and use synchronous
processing there.
DoDi
More information about the Lazarus
mailing list