Wrap defvar and declare-function in eval-when-compile