[Lazarus] Mutlithreaded Dll Callback crashes my Application

Alexander Grau alex at grauonline.de
Tue Aug 3 12:32:50 CEST 2010


Maik Wojcieszak schrieb:
>>
> That's what I thought too.
> I know about the LCL limitations regarding multithreading. It is the 
> same with VCL. There should be now problem to use objects dreived from 
> TComponent as long as they
> don't do any visual stuff.

Try the following to limit the problem:  in your callback do not call 
*ANY* FPC runtime related code - Just a "Win32 MessagBox(0, "hi", 
"text", MB_OK)".  Add the process id (GetProcessId) to that dialog 
output and also in your main program (to see if you are really in an 
external thread).

If that works, call a simple global FPC function (no object) and again 
just that callback there.

After that works, just a simple FPC object call and again that message box.

I still assume in the compiler version you are using, you simply can't 
call FPC objects inside external threads.

Also have a look at the mantis - e.g. see if 0012987 is related to your 
problem? (http://bugs.freepascal.org/view.php?id=12987)


I might be fully wrong with my assumptions, I'm just thinking loudly 
because I had the same issue - just another architecture :-)





More information about the Lazarus mailing list