[Lazarus] Mutlithreaded Dll Callback crashes my Application

Maik Wojcieszak maikwo at googlemail.com
Wed Aug 25 16:09:54 CEST 2010


Alexander,

I tried you're test app already and it worked as you said. So does my 
test app if I do only one thing at time. After changing you're test app 
to process
multiple threads at the same time it crashed too.

Alexander Grau schrieb:
>
>
> Maik,
>
> Did you try out the console test program I posted? It uses your DLL 
> that runs a C thread and that C thread calls back the FPC function. 
> Even more, this FPC callback function then calls a FPC object method.
>
> My program shows that there is nothing wrong with FPC (on Win32) and 
> external C threads - it just works.
Well, it doesn't if you stress this stuff a bit.
>
> My assumption :  there is something else wrong in your code - use my 
> code and add one piece after the other of your code. For example, 
> first just try to make my test app a simple LCL app (just a simple 
> form). If that works too, add the dynamic function mapping you used. 
> If that works too, make the wrapper (TComponent) you wrote etc.
The question is: What is wrong ?
>
> Again : You can call FPC functions/objects in external C threads - 
> there must be something else wrong in your program ;-) ...
...

I've choosen the vortex (beep )binding as an example because my dll does 
exactly the same.
In fact it uses the vortex library to implement user protocols. There 
must be a reason for those guys (and the
vortex programmers) to add a mechanism to use a different threading when 
using FPC.
At the moment I will follow this idea to check if it solves my problem 
and post my result here.

Maik





More information about the Lazarus mailing list