[Lazarus] Mutlithreaded Dll Callback crashes my Application

Michael Schnell mschnell at lumino.de
Tue Aug 3 13:09:15 CEST 2010


  On 08/03/2010 12:21 PM, Maik Wojcieszak wrote:
> I am using __declspec(dllexport) on windows with Visual Studio 2005.
Exactly what my colleagues do - just using Delphi instead of FPC/Lazarus.
> I know that I can use stdcall instead but currently I saw now reason 
> to do so.
Agreed.

> That's the problem with most language bindings. The object I've 
> mentioned is implented in Pascal. It's only the pointer which is 
> stored and passesd to the callback to access it.
OK passing a pointer to the C DLL just to store it, providing it in a 
callback to Pascal and use it there should be OK.
>
>> Of course a multithreaded DLL offers some even more advanced 
>> problems. I would do a test with a singlethreaded DLL just to test 
>> all aspects of the interface to your FPC project and activate the 
>> threads later.
>
> Great, let me know if there is some more information I can provide.
Ooops. "I would..."  did not mean an offer to actually do it here :(. 
Take it for "you should" :).
> 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.
Unfortunately this nowhere is decently documented - neither with Lazarus 
nor with Delphi. But we handle this in the same way....

-Michael




More information about the Lazarus mailing list