Free Pascal => Windows => Topic started by: chucky on May 05, 2016, 07:15:27 pm

Title: External Threads Under Windows
Post by: chucky on May 05, 2016, 07:15:27 pm
I have a DLL which provides an API for ActiveTick stock market data. I can use the C functions to establish a connection with the server just fine, but results from data requests are returned through a callback on a new thread that the DLL creates. I get no response back and im assuming its because I am not detecting and servicing the new thread in my calling code. Ive done forking on Linux but Im new to thread programming in windows. Ive searched google for answers and cant come up with anything other than its probably not possible to access an external C thread with freepascal. The DLL also has C++ wrappers which I have used to create a C++ aplication and everything works fine except I hate C++ and want to use pascal in this project. HELP!
Title: Re: External Threads Under Windows
Post by: HeavyUser on May 05, 2016, 07:40:21 pm
It makes no sense, if a new thread is created from the dll then the dll should call your defined call back procedure which must be self contained and never access unprotected data. If the debuger can't debug threads then you probably will never hit a break point but you might get away with a record in a file with the data or even a autoinc value posted to the main thread using messages or the queue procedure.
what ever you do, do not use showmessage, msgdlg or any screen related call inside your call back. For more information you have to post more information, posting the manual of the dll might be a good idea.
TinyPortal © 2005-2018