>> Now I wrote a simple test program which Loadlibraries the dll, waits >> some ms and freelibraries it then and waits another few ms. This is done >> up to 1000 times to check whether it works or not. if only done a few >> times all is well, but when really trying to do it 1000x it crashes (the >> app hangs) and even windows explorer is crashed so that the PC has to be >> rebootet then. It crashes after 200-300 cycles mostly. > > Just to be sure it is related to ICS: remove any ICS code from the DLL and > run your test again.
No, I think it is not ICS related yet, I just wanted this to be stable *before* putting much code of ICS into it. I don't want to make the same mistake as in the first run. Build it step by step now and test after each step. > >> - this thread has a message pump with peekmessage and pm_remove > > Bad. Use GetMessage or your thread will eat all CPU available to it. Okay, but I thought it could block events, but as they're triggered by windows messages anyway any timers or ICS components etc. which use events will be triggered then and run fine I assume. > >> How can I avoid to terminate the thread from finalize if the normal way >> fails maybe due to a program crash? > > Why worry if program crash ? A crash is a crash. Yes and no. If the program simply fails I don't want to have to restart the whole PC just because of that. The dll should terminate all connections gracefully then so that you just need to restart the failed app. again and all is okay. > >> What happens if the dll is used statically and what if dynamically? > > No change except the time when finalize called. > >> What if several apps use the dll at the same time? > > No change. > >> is initialization/finalization being called several times? > > Yes, but with different data sections. You can ignore the fact that your DLL > is loaded by several apps. Hm, but it the thread is to be created only once, it's a problem if it is created from initialize. Okay, as somebody else already told me I shouldn't create the thread from initialize anyway. If I have changed that I won't be a problem anyway. Greetings Markus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be