Fix Windows build.
Sync LMDB code.
First attempt at making things somewhat cleaner.

- On windows also compile all shared objects into a dll.
- Implement the DCR (Device Control Record) as an inherited class of
  SMARTALLOC just like most others and implement a proper constructor
  for it. The new_dcr function is now replaced with a instantiate of the
  class and then a call to setup_new_dcr_device()
- Abstract the askdir functions as methods of the DCR (Device Control
  Record) and implement a special derived class for the stored and btape
  that abstracts the special functions for those and make the rest use
  the default dummy methods. This way we can nice and cleanly implement
  this for the different programs.
- Drop the wait_device_release conditional global variable, instead
  create a single function entry point release_device_cond() that gets
  called when we want the conditional variable to be signaled.