title: I need to call a dll that is calling 5 other dlls repeatedly in one application
body: <p>I'm currently using SQLitening (www.sqlitening.com) in a C++ application where I'm calling SQLitening.dll.  SQLitening.dll makes subsequent calls to SQLiteningClient.dll, Zlib.dll and SQLite3.dll.  I am hooking SQLitening.dll explicitly, executing a few functions, and then I am closing the connection and dereferencing the dll with FreeLibrary.</p>
  
  <p>However, the subsequent dlls (SQLiteningClient.dll, etc) are remaining hooked to the calling process.  Whenever I try to hook SQLitening.dll again, it hooks fine, but some of the functions misbehave, such as the function to query the remote database.  I can't help but think this is because those dlls aren't being free'd properly.  Whenever I had hooked the dll implicitly (hooking each function globally), everything worked fine as long as I kept it in memory the whole time.  However, I need to do this explicitly.</p>
  
  <p>Note: Fred Meier of SQLitening said that explicit linking worked fine in a PowerBasic application.  I should also note that SQLitening was written in PowerBasic.</p>
  
  <p>Is there any way to spawn a separate process or thread for SQLitening.dll to hook everything to, so that when I dereference SQLitening I can just kill that process?  Or is there a special way to make sure that everything that SQLitening calls is being dereferenced properly?  Thanks.</p>
  
  <p>-Matt Phelps</p>
  
  <p>-Resolution Systems</p>