Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Dynamic module loading
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dimitri Timofeev <dt@d...>
Subject: [Caml-list] Dynamic module loading
Greetings!

Thanks to all for your help! Your answers were very useful for me.

There is another question at the same subject. Can i use LablTk in
dynamically loaded module? I've tried and i've encountered a problem.

I take some code (i.e. eyes.ml) using LablTk. I write an example
that should be able to load modules:

let main () =
    try
        Dynlink.init ();
        Dynlink.add_interfaces ["Pervasives"; "Printexc"; "Tk"; "Frame"]
                               [Sys.getcwd (); "/usr/lib/ocaml";
                                "/usr/lib/ocaml/labltk"];
        Dynlink.loadfile Sys.argv.(1)
    with
    | Dynlink.Error e ->
        print_string "Dynamic linking error: ";
	print_string (Dynlink.error_message e);
	print_newline ()
;;

let _ = main ()
;;

I compile main.ml with command line "ocamlc -o main dynlink.cma main.ml"
and eyes.ml with "ocamlc -c -I +labltk eyes.ml".

Then i try to call it: "./main eyes.cmo", and i get Dynlink.Error
exception saying that there is no implementation available for Support.
But if i try to add "Support" into modules list, i get exception
Not_found. It seems right, because i have no "support.cmi" file.

Do i have some mistakes in my code or command lines, or i'm going a wrong
way?

Thanks again for your help. I'm very glad to be on this list.

Dimitri


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr