[Lazarus] Mutlithreaded Dll Callback crashes my Application

Sven Barth pascaldragon at googlemail.com
Wed Aug 25 20:47:23 CEST 2010


On 25.08.2010 20:24, Alexander Grau wrote:
> José Mejuto schrieb:
>> It is also desirable to add the line "IsMultithread:=true" in the
>> first line of .lpr (after the begin) to activate the Multithread RTL
>> in the FPC, otherwise it could not be active.
>>
>> I had tested it with 200 threads and using the sleeps no problem at
>> all.
> Hello José,
>
> I have tried to reduce the DLL problem into a test that doesn't need any
> external DLL. It crashes too.
>
> Here's the test program:
>
> http://grauonline.de/alexwww/tmp/extthread.zip
>
> Can you see any analogy to the problem? I have tried to add your
> suggested "IsMultithread:=true" and it doesn't make any difference. I
> think there's something wrong in the FPC runtime.

IsMultiThread is only a variable. Setting it is only useful recognized 
once FPC threading code is called. So instead of setting IsMultiThread 
to true you must create at least one thread in FPC (it can be a dummy 
thread that immediately terminates).

That might not solve the Writeln problems that Alexander discovered, though.

Regards,
Sven




More information about the Lazarus mailing list