From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id EAA24665; Tue, 1 May 2001 04:57:46 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id EAA24624 for ; Tue, 1 May 2001 04:57:45 +0200 (MET DST) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f412vh520507 for ; Tue, 1 May 2001 04:57:43 +0200 (MET DST) Received: from localhost (patrick@localhost) by fledge.watson.org (8.11.3/8.11.3) with SMTP id f412vZ640192; Mon, 30 Apr 2001 22:57:35 -0400 (EDT) (envelope-from patrick@watson.org) Date: Mon, 30 Apr 2001 22:57:35 -0400 (EDT) From: Patrick M Doane To: David Gurr cc: garrigue@kurims.kyoto-u.ac.jp, caml-list@inria.fr Subject: Re: [Caml-list] ocamlmktop and includes In-Reply-To: <200105010127.SAA18051@mrs.mrs.med.ge.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi Jacques, David's clarification is correct. At first, I thought I was getting error messages because .cmo files were not being linked into the toplevel. Now I understand the problem was with the .cmi files. The Dynlink features are quite nice but don't seem to be quite the right match. Patrick On Mon, 30 Apr 2001, David Gurr wrote: > Hi, That is what I though at first. But I think this is not fully > what he wishes. Dynlink.add_available_units makes digests available to > the dynlinker but it does not make the persistent structures (cmi's) > available to the compiler in the toplevel environment. One could argue > that ocmalmktop should embed both the cmo's and their cmi's in such a > way that the cmi's would be added to the initial env of the custom > toplevel. -D > > > From owner-caml-list@pauillac.inria.fr Mon Apr 30 18:11:29 2001 > > From: Jacques Garrigue > > To: patrick@watson.org > > Cc: caml-list@inria.fr > > X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f > > Subject: Re: [Caml-list] ocamlmktop and includes > > Mime-Version: 1.0 > > Content-Transfer-Encoding: 7bit > > Date: Tue, 01 May 2001 10:05:37 +0900 > > X-Dispatcher: imput version 20000228(IM140) > > > > From: Patrick M Doane > > > > > Alternatively, it would be really nice to make stand-alone byte code > > > interpreters which have the .cmo files builtin. > > > > If you just need a custome bytecode interpreter, that's not (too) > > difficult. > > The idea is to use the Dynlink module: > > Just build a custom executable, including all the libraries you need, > > and registering the modules you want to use with > > Dynlink.add_available_units. This function takes the unit name, and a > > CRC (in fact a MD5) for the .cmi, which you can get with > > lib/ocaml/extract_crc. This way you don't need neither the .cma nor > > the .cmi's for your libraries. > > The your program will load all .cmo or .cma given on the command line, > > using Dynlink.loadfile. > > I join an exemple of such a bytecode interpreter including plenty of > > libraries. (The CRC's are not up to date) > > > > Cute, no? > > There is a small pitfall: you can only make available an interface > > when there is an implementation. So if you have pure interfaces (a .cmi > > but no .cmo), you have to copy the the .mli to .ml, and compile it, > > to get an empty implementation matching the .cmi. > > > > Hope this helps, > > > > Jacques Garrigue > > > > (* Link with everything. Compile with: > > ocamlc -I +labltk -o ocamlloader -linkall dynlink.cma unix.cma dbm.cma \ > > str.cma nums.cma labltk.cma stdclass.cma crcs.ml > > To get all crcs in one directory: > > extract_crc `\ls *.cmi | sed "s/.cmi//" | capitalize` > > *) > > > > let crc_unit_list = [ > > "Arg", > > "\132\241\139\095\018\209\141\180\176\082\093\079\208\235\049\083"; > > "Arith_status", > > "\089\253\033\080\043\135\175\127\166\158\179\030\223\236\054\166"; > > "Array", > > "\146\022\203\069\253\093\134\037\233\194\070\176\050\248\097\172"; > > "Big_int", > > "\243\042\214\129\099\114\179\135\162\146\175\227\015\202\143\160"; > > "Callback", > > "\213\119\018\062\250\024\055\143\129\161\094\222\057\023\146\248"; > > "Char", > > "\184\168\151\226\206\081\149\197\060\011\054\064\207\150\178\138"; > > "Dbm", > > "\224\114\137\160\060\165\253\220\099\067\179\255\250\145\095\153"; > > "Digest", > > "\132\054\239\158\106\045\248\017\082\204\225\229\020\063\091\254"; > > "Dynlink", > > "\135\180\176\101\073\127\073\073\127\151\142\161\067\053\021\073"; > > "Filename", > > "\097\078\243\010\046\199\169\212\199\183\242\067\050\043\255\112"; > > "Format", > > "\255\061\006\074\141\083\248\109\242\099\050\153\088\097\166\055"; > > "Gc", > > "\089\227\107\050\058\044\003\036\239\188\130\047\116\033\090\028"; > > "Genlex", > > "\179\252\157\000\199\039\171\234\006\063\191\135\168\067\016\174"; > > "Graphics", > > "\205\233\013\180\028\114\139\004\004\109\049\042\182\126\001\137"; > > "Hashtbl", > > "\069\196\160\110\103\090\223\223\129\219\190\170\014\091\012\007"; > > "Lazy", > > "\079\216\032\236\211\038\005\010\162\001\239\179\109\114\117\147"; > > "Lexing", > > "\182\088\003\040\254\005\244\149\087\093\237\123\178\173\001\112"; > > "List", > > "\034\235\035\108\154\120\077\156\180\011\013\141\063\152\055\055"; > > "Map", > > "\112\213\080\192\236\152\247\119\049\174\106\154\198\248\038\243"; > > "Marshal", > > "\212\185\081\165\100\136\097\073\164\142\082\147\055\242\088\149"; > > "Nat", > > "\015\202\018\039\135\054\224\200\222\013\194\080\165\243\250\146"; > > "Num", > > "\243\243\021\151\036\013\082\157\233\216\151\178\043\006\159\056"; > > "Obj", > > "\194\237\101\179\047\114\046\161\072\117\212\196\008\083\213\072"; > > "Oformat", > > "\040\190\172\213\155\053\141\220\205\093\073\042\228\252\159\179"; > > "Ogenlex", > > "\248\206\017\001\181\044\188\030\052\115\066\169\211\058\231\051"; > > "Ohashtbl", > > "\211\072\131\214\164\212\100\103\164\246\170\106\196\007\157\180"; > > "Omap", > > "\052\094\138\008\100\038\194\008\000\094\175\065\019\178\109\103"; > > "Omapping", > > "\225\081\091\064\046\201\022\178\088\089\230\124\177\109\178\248"; > > "Oo", > > "\253\246\076\227\151\115\217\141\048\042\155\159\061\051\168\158"; > > "Oqueue", > > "\147\020\229\095\046\075\213\196\181\031\216\209\074\236\217\075"; > > "Oset", > > "\056\213\244\036\127\109\042\098\080\098\130\063\120\114\043\084"; > > "Ostack", > > "\173\008\203\219\123\041\247\255\037\148\016\143\155\023\020\021"; > > "Ostream", > > "\105\211\112\045\064\001\225\086\221\013\086\221\012\174\011\188"; > > "Parsing", > > "\238\091\167\164\087\104\115\231\007\133\009\041\001\020\238\217"; > > "Pervasives", > > "\081\190\153\116\206\164\208\178\173\067\134\249\076\133\233\089"; > > "Printexc", > > "\068\225\231\087\144\035\057\101\195\150\166\074\076\076\191\093"; > > "Printf", > > "\114\086\103\091\204\204\191\201\249\027\107\015\067\094\248\184"; > > "Profiling", > > "\124\209\206\043\202\119\097\026\229\151\251\185\190\080\244\189"; > > "Queue", > > "\106\035\239\245\185\045\075\131\162\053\038\054\070\007\103\098"; > > "Random", > > "\225\240\003\163\080\059\165\202\076\018\224\180\160\191\100\140"; > > "Ratio", > > "\176\030\022\221\242\249\175\107\233\038\141\239\208\245\187\163"; > > "Set", > > "\241\198\021\016\215\179\209\129\251\204\237\117\232\142\136\012"; > > "Sort", > > "\042\013\126\242\024\204\017\183\155\004\123\201\200\197\152\248"; > > "Stack", > > "\035\108\042\081\047\041\088\231\118\222\233\248\184\053\215\118"; > > "Std_exit", > > "\167\124\048\151\124\056\054\043\214\131\251\242\175\132\166\243"; > > "Str", > > "\135\231\101\157\048\245\001\093\024\242\163\178\065\016\157\020"; > > "Stream", > > "\068\127\097\226\098\205\064\112\082\037\105\079\236\126\121\046"; > > "String", > > "\013\045\050\104\222\055\220\090\092\179\113\181\072\212\082\012"; > > "Sys", > > "\041\089\246\208\014\005\096\240\061\077\000\157\239\193\241\111"; > > "Topdirs", > > "\164\224\058\210\062\157\159\029\044\254\058\220\097\244\177\215"; > > "Toploop", > > "\038\007\001\223\104\189\070\057\057\062\213\241\225\121\132\111"; > > "Unix", > > "\100\176\025\054\154\219\152\081\252\126\095\147\016\069\153\070"; > > "Weak", > > "\180\180\008\001\065\221\239\201\173\053\038\214\000\202\187\083"; > > "Balloon", > > "\064\130\212\209\166\007\028\236\137\067\132\239\066\078\240\172"; > > "Bell", > > "\017\183\096\172\169\146\009\071\065\080\067\231\011\088\184\145"; > > "Button", > > "\228\106\173\140\076\048\063\055\228\010\106\073\000\157\054\103"; > > "Canvas", > > "\018\123\213\204\031\021\012\106\218\240\020\003\047\011\035\087"; > > "Checkbutton", > > "\082\050\250\035\240\200\013\191\168\107\238\089\104\206\068\016"; > > "Clipboard", > > "\090\120\177\182\099\141\025\169\233\251\040\153\164\102\200\130"; > > "Dialog", > > "\215\111\103\076\009\164\108\208\046\222\025\113\144\254\041\203"; > > "Entry", > > "\090\241\159\056\214\250\171\107\145\014\042\143\189\248\093\132"; > > "Fileevent", > > "\213\136\118\001\080\039\117\214\196\120\102\112\248\216\253\214"; > > "Fileselect", > > "\016\042\091\024\048\222\255\072\189\205\042\141\195\173\019\025"; > > "Focus", > > "\079\179\218\046\103\199\007\028\007\246\146\207\009\087\240\231"; > > "Frame", > > "\067\222\053\008\203\055\121\013\189\206\219\142\169\160\211\056"; > > "Grab", > > "\217\048\223\133\044\123\178\056\118\115\241\142\119\238\094\049"; > > "Grid", > > "\123\214\154\096\213\037\019\209\194\242\049\062\059\087\089\127"; > > "Imagebitmap", > > "\205\003\180\038\057\077\191\153\202\132\122\003\161\154\245\180"; > > "Imagephoto", > > "\132\186\156\150\254\168\050\097\146\249\159\173\214\194\163\248"; > > "Label", > > "\030\162\169\108\217\134\207\143\097\007\015\088\009\047\168\112"; > > "Listbox", > > "\255\091\065\145\151\247\020\103\234\034\115\204\014\247\202\243"; > > "Menu", > > "\133\213\100\249\249\029\073\255\154\030\187\015\067\024\214\010"; > > "Menubutton", > > "\215\155\194\167\196\152\066\013\148\035\062\095\181\076\152\042"; > > "Message", > > "\137\228\064\194\061\220\048\156\177\194\193\218\153\105\245\029"; > > "Option", > > "\002\048\023\081\052\014\221\032\078\004\079\127\008\153\241\127"; > > "Optionmenu", > > "\132\032\144\168\045\172\052\110\234\147\145\036\125\098\105\014"; > > "Pack", > > "\007\057\162\105\211\180\208\132\037\061\148\070\011\171\207\128"; > > "Palette", > > "\014\068\206\100\061\249\187\150\248\168\052\127\235\171\003\030"; > > "Place", > > "\074\007\070\132\132\124\203\041\177\117\118\129\064\169\207\006"; > > "Protocol", > > "\044\093\149\050\026\194\067\214\011\224\026\017\085\193\231\100"; > > "Radiobutton", > > "\128\129\131\210\169\194\242\058\141\128\163\033\133\192\094\120"; > > "Scale", > > "\227\078\017\132\154\090\007\086\144\195\166\055\233\180\183\131"; > > "Scrollbar", > > "\177\242\191\174\051\150\159\225\108\101\233\010\112\084\057\216"; > > "Selection", > > "\173\172\218\213\029\036\130\012\033\235\031\238\076\067\219\017"; > > "Support", > > "\159\177\172\212\190\133\232\032\192\082\170\250\049\082\063\184"; > > "Text", > > "\027\143\132\012\023\218\179\073\003\002\081\199\183\010\107\161"; > > "Textvariable", > > "\172\029\217\109\207\144\254\185\068\049\028\090\224\087\177\139"; > > "Timer", > > "\168\141\189\094\081\187\049\026\012\239\025\071\220\014\024\188"; > > "Tk", > > "\155\008\032\103\156\245\158\235\161\052\121\080\091\119\211\242"; > > "Tkwait", > > "\221\238\138\104\160\070\189\107\092\058\048\098\052\137\127\153"; > > "Toplevel", > > "\091\097\016\210\132\101\149\002\036\075\240\001\240\192\132\178"; > > "Widget", > > "\049\215\061\172\124\063\244\113\107\137\123\208\197\169\136\037"; > > "Winfo", > > "\020\023\187\002\192\057\213\009\192\237\092\046\228\130\021\142"; > > "Wm", > > "\169\231\071\215\217\053\030\124\162\209\103\160\145\052\110\120" > > ] > > > > open Dynlink > > > > let _ = > > init (); > > add_available_units crc_unit_list; > > allow_unsafe_modules true; > > try > > for i = 1 to Array.length Sys.argv - 1 do > > loadfile Sys.argv.(i) > > done > > with > > Error err -> prerr_endline (error_message err) > > | exn -> Printexc.catch raise exn > > ------------------- > > To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr > > > ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr