Hi ! I think there is a conflict using the DBus binding (libdbus-ocaml-dev) and at the same time the SSL one for OCaml (libssl-ocaml-dev). Because of the line "Ssl.create_context Ssl.TLSv1 Ssl.Client_context", I can do a first DBus call notification but the second one blocks the whole program. I've only been interested in notification calls.
I attach to this email 3 files so you can test. The "dbus_call.ml" is the code the developper provided as an example. Before using the DBus binding, I used to make a system call to "notify-send" in my project and it worked. This has been tested with D-Bus binding 0.29 and SSL binding 0.4.3. I also sent an email to the developper. Hope this can help in some ways. Grégory BELLIER.
open Unix open Dbus_call let _ = Printf.printf "Two '5' should be printed\n"; Pervasives.flush Pervasives.stdout; Ssl_threads.init (); Ssl.init (); ignore (Ssl.create_context Ssl.TLSv1 Ssl.Client_context); dbusplop "A"; dbusplop "B"; Printf.printf "Exiting...\n"; Pervasives.flush Pervasives.stdout; exit 0
Makefile
Description: Binary data
let print_dbus_ty_list l =
List.iter (fun o -> Printf.printf "%s\n" (DBus.string_of_ty o)) l
;;
let dbusplop txt =
let notif_interface = "org.freedesktop.Notifications" in
let notif_name = notif_interface in
let notif_path = "/org/freedesktop/Notifications" in
let send_msg ~bus ~destination ~path ~intf ~serv ~params =
let msg = DBus.Message.new_method_call destination path intf serv in
DBus.Message.append msg params;
let r = DBus.Connection.send_with_reply_and_block bus msg (-1) in
let l = DBus.Message.get r in
l
in
Printf.printf "1\n";
Pervasives.flush Pervasives.stdout;
let send_notif_msg = send_msg ~destination:notif_name ~path:notif_path ~intf:notif_interface in
Printf.printf "2\n";
Pervasives.flush Pervasives.stdout;
let bus = DBus.Bus.get DBus.Bus.Session in
Printf.printf "3\n";
Pervasives.flush Pervasives.stdout;
let params = [
DBus.String "n";
DBus.UInt32 1l;
DBus.String "x";
DBus.String "z";
DBus.String txt;
DBus.Array (DBus.Strings []);
DBus.Array (DBus.Dicts ((DBus.SigString, DBus.SigVariant), []));
DBus.Int32 4000l;
] in
Printf.printf "4\n";
Pervasives.flush Pervasives.stdout;
let r = send_notif_msg ~bus ~serv:"Notify" ~params in
Printf.printf "5\n";
Pervasives.flush Pervasives.stdout;
print_dbus_ty_list r;
()
;;

