DLLs and Threads


I have a weird problem I don't know how to solve. Tried to google about it, but so far I've been unsuccessful.

I have made a multithreaded application using a class derived from TThread. But my thread was acting strange. It would only work as long as I kept moving mouse on my Form or if I had a cursor blinking somewhere. If I removed focus from the Form on some other windows the Thread freezes until I move the mouse over it again.

I tried to locate the problem by commenting out parts of my code and I found out that when I commented out all the functioncalls that were included in the project through dll import (extern "C" __declspec(dllimport) void functionname();), the thread starts working normally.

Btw, those functions are not even called inside that thread. They are called in OnFormCreate event. I tried to remove them from there and moved them to ButtonClick function and then launch the thread without pressing the button and I still had that bug.

Anyone has any ideas what could be causing this?

Thanks in advance


  • Hello,

    Just wanted to say, that I solved the problem. It appears that the issue was in DLL files themselves. Inside their code there were places where 'Application->ExeName' was used.

    Don't ask how I tracked it down :) But once I removed them (replaced with a parameter passed to the function) everything was working fine.

    I'd like to know why it was acting that way though. If anyone has explanation - please share :)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion