caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Dynamic module loading
@ 2001-11-12  5:21 Dimitri Timofeev
  0 siblings, 0 replies; 7+ messages in thread
From: Dimitri Timofeev @ 2001-11-12  5:21 UTC (permalink / raw)
  To: OCaml mailing list

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


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [Caml-list] Dynamic module loading
@ 2001-11-10 23:27 Dimitri Timofeev
  2001-11-11  0:15 ` Michael Hicks
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dimitri Timofeev @ 2001-11-10 23:27 UTC (permalink / raw)
  To: OCaml mailing list

Greetings!

I'm a newbie in OCaml programming and in this list, so i'm sorry if my
questions aren't smart :).

Can i dynamically load OCaml bytecode modules in runtime from OCaml
program compiled to native code? Can i do it if i compile modules to
native code? If the answer is "yes", does the method work at Win32?

If i can't use native-compiled modules only, there is another question.
That is the minimal set of OCaml files i need to distribute with a
program if i want users to be able to run program compiled to bytecode
without installing OCaml itself?

Thanks!

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-11-12 12:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-12  5:21 [Caml-list] Dynamic module loading Dimitri Timofeev
  -- strict thread matches above, loose matches on Subject: below --
2001-11-10 23:27 Dimitri Timofeev
2001-11-11  0:15 ` Michael Hicks
2001-11-11 22:09   ` Vitaly Lugovsky
2001-11-12 11:22     ` Fabrice Le Fessant
2001-11-11  1:00 ` malc
2001-11-11 16:45 ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).