let ocamltop_output () =
  match !ocamltop_output with
    None ->
      let o = new ocamltop_output
        ~on_destroy: (fun () -> ocamltop_output := None)
          output_name
      in
      ocamltop_output := Some o ;
      o
  | Some o -> o