[fpc-pascal] Stack problem in externally called callback function
wimpienortje at gmail.com
Wed Aug 5 08:22:30 CEST 2009
Jonas Maebe wrote:
> I think the "easiest" way for you to do this would be to do something
> similar to what the FPC rtl does: write your own function that does
> all of this initialisation, and pass that one to pthread_create as the
> function to run in the new thread. Then from this function perform all
> initialisation, and finally call the original function.
Thanks. I have done this and it is working. It is not the ideal solution
though....BeginThread expects a 'register' function as the thread
function, while the library provides a 'cdecl' function. This means I
had to wrap the C thread function into another function call. So there
are now quite a bit of layering happening on top of the original thread
function. I think it would be good if BeginThread can accept both
register functions and cdecl functions.
And then I hope the library author accept my changes.
More information about the fpc-pascal