Re: [fpc-pascal] Stack problem in externally called callback function

2009-08-04 Thread Wimpie Nortje
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

Re: [fpc-pascal] Stack problem in externally called callback function

2009-08-03 Thread Jonas Maebe
On 03 Aug 2009, at 08:49, Wimpie Nortje wrote: The FPC thread setup code (CAllocateThreadVars, InitThread) happens inside the newly created thread before the user's thread function starts. The only viable way I see to get support from the C library is for it to inform FPC about a new thr

Re: [fpc-pascal] Stack problem in externally called callback function

2009-08-02 Thread Wimpie Nortje
The FPC thread setup code (CAllocateThreadVars, InitThread) happens inside the newly created thread before the user's thread function starts. The only viable way I see to get support from the C library is for it to inform FPC about a new thread after creation, but this means that the C user's

Re: [fpc-pascal] Stack problem in externally called callback function

2009-08-02 Thread Wimpie Nortje
Thanks, I'll have a look Jonas Maebe wrote: On 02 Aug 2009, at 20:02, Wimpie Nortje wrote: Thanks for the response. The library uses a centralised function to start all its threads using pthread_create. If I can make this central function inform FPC about all the threads created, would thi

Re: [fpc-pascal] Stack problem in externally called callback function

2009-08-02 Thread Jonas Maebe
On 02 Aug 2009, at 20:02, Wimpie Nortje wrote: Thanks for the response. The library uses a centralised function to start all its threads using pthread_create. If I can make this central function inform FPC about all the threads created, would this work? There is no interface in the RTL t

Re: [fpc-pascal] Stack problem in externally called callback function

2009-08-02 Thread Wimpie Nortje
Thanks for the response. The library uses a centralised function to start all its threads using pthread_create. If I can make this central function inform FPC about all the threads created, would this work? Assuming it would work: what information would FPC require? When would this info be

Re: [fpc-pascal] Stack problem in externally called callback function

2009-08-01 Thread Jonas Maebe
On 31 Jul 2009, at 19:05, Wimpie Nortje wrote: I am trying to use a shared lib written in C in my FPC program. The lib creates a number of threads and requires callbacks into the main app. It can call the callback from any of the threads. Calling FPC code from threads not created by FPC do