+ ) all_functions_sorted;
+
+ pr "\
+(** {2 Object-oriented API}
+
+ This is an alternate way of calling the API using an object-oriented
+ style, so you can use [g#add_drive_opts filename] instead of
+ [Guestfs.add_drive_opts g filename]. Apart from the different style,
+ it offers exactly the same functionality.
+
+ Calling [new guestfs ()] creates both the object and the handle.
+ The object and handle are closed either implicitly when the
+ object is garbage collected, or explicitly by calling the [g#close ()]
+ method.
+
+ You can get the {!Guestfs.t} handle by calling [g#ocaml_handle].
+
+ Note that methods that take no parameters (except the implicit handle)
+ get an extra unit [()] parameter. This is so you can create a
+ closure from the method easily. For example [g#get_verbose ()]
+ calls the method, whereas [g#get_verbose] is a function. *)
+
+class guestfs : unit -> object
+ method close : unit -> unit
+ method set_progress_callback : progress_cb -> unit
+ method clear_progress_callback : unit -> unit
+ method ocaml_handle : t
+";
+
+ List.iter (
+ function
+ | name, ((_, [], []) as style), _, _, _, _, _ ->
+ pr " method %s : unit -> " name;
+ generate_ocaml_function_type style;
+ pr "\n"
+ | name, style, _, _, _, _, _ ->
+ pr " method %s : " name;
+ generate_ocaml_function_type style;
+ pr "\n"
+ ) all_functions_sorted;
+
+ pr "end\n"