<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/01/0650f6f66d394345038598ab4b6dfae6"
  from="Stefano Zacchiroli &lt;zack@b...&gt;"
  author="Stefano Zacchiroli"
  date="2003-01-21T18:56:10"
  subject="Re: [Caml-list] load modules by name"
  prev="2003/01/6f1f42a6fc6d82c515c0fbf20ed92a74"
  next="2003/01/3876bfc8907bed74eae34a1e6f10c95e"
  prev-in-thread="2003/01/c5aa93d21c0c93504dd2d03bd7e68762"
  next-in-thread="2003/01/a81f1cb20b0c89d47609694a59035408"
  prev-thread="2003/01/2b72d4c560e6efe5525adf0843857a06"
  next-thread="2003/01/b4a8ce11a48f9cc6cbf897c6b7a41e47"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] load modules by name">
<msg 
  url="2003/01/c5aa93d21c0c93504dd2d03bd7e68762"
  from="Pietro Abate &lt;Pietro.Abate@a...&gt;"
  author="Pietro Abate"
  date="2003-01-21T07:17:01"
  subject="[Caml-list] load modules by name">
<msg 
  url="2003/01/0650f6f66d394345038598ab4b6dfae6"
  from="Stefano Zacchiroli &lt;zack@b...&gt;"
  author="Stefano Zacchiroli"
  date="2003-01-21T18:56:10"
  subject="Re: [Caml-list] load modules by name">
</msg>
<msg 
  url="2003/01/a81f1cb20b0c89d47609694a59035408"
  from="michael-grunewald@w..."
  author="michael-grunewald@w..."
  date="2003-01-23T10:27:22"
  subject="[Caml-list] Re: load modules by name">
</msg>
</msg>
</thread>

<contents>
On Tue, Jan 21, 2003 at 06:22:28PM +1100, Pietro Abate wrote:
&gt; is it possible ?

Yes, just use the Dynlink module.

You can find a great usage example in the O'Reilly book [1] (debian
package available in debian/unstable ocaml-book-{en,fr}).

Anyway, returning to your example you should have an association list
ref, say "algos", and you should use it as

  let algo =
    try
      List.assoc "command_line_option" !algos
   with Not_found -&gt; failwith "Module not loaded"

Then you should have a set of .cmos that you should load using
'Dynlink.loadfile', each module should update the 'algos' association
list adding itself to it.

Hope this helps,
Cheers.

[1] http://caml.inria.fr/oreilly-book/html/

-- 
Stefano Zacchiroli  -  Undergraduate Student of CS @ Uni. Bologna, Italy
zack@{cs.unibo.it,debian.org,bononia.it}  -  http://www.bononia.it/zack/
"  I know you believe you understood what you think I said, but I am not
sure you realize that what you heard is not what I meant!  " -- G.Romney
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

