Dynamical Charges at Surfaces and Interfaces: their Role in the Schottky Barrier Problem