From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 3FA0E7EE51 for ; Sun, 14 Apr 2013 11:31:22 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=212.227.126.171; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=212.227.126.171; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of postmaster@moutng.kundenserver.de designates 212.227.126.171 as permitted sender) identity=helo; client-ip=212.227.126.171; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@moutng.kundenserver.de"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApkBAAZ2alHU436rk2dsb2JhbABKBoM8rzOSGYEEFg4BAQEBBwsLCRQDJYIfAQEEATo0CwUuDV0JEgYTCQmHcAMJCgiwdQOJZxWIfYRfgQAmB4NBA44piX2SfQ X-IPAS-Result: ApkBAAZ2alHU436rk2dsb2JhbABKBoM8rzOSGYEEFg4BAQEBBwsLCRQDJYIfAQEEATo0CwUuDV0JEgYTCQmHcAMJCgiwdQOJZxWIfYRfgQAmB4NBA44piX2SfQ X-IronPort-AV: E=Sophos;i="4.87,470,1363129200"; d="scan'208";a="13180060" Received: from moutng.kundenserver.de ([212.227.126.171]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 14 Apr 2013 11:31:21 +0200 Received: from office1.lan.sumadev.de (dslb-094-219-220-021.pools.arcor-ip.net [94.219.220.21]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0LiawD-1Uzp9J0z6b-00cnnh; Sun, 14 Apr 2013 11:31:20 +0200 Received: from samsung (ip-5-146-55-186.unitymediagroup.de [5.146.55.186]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id C713EC00D0; Sun, 14 Apr 2013 11:31:19 +0200 (CEST) Date: Sun, 14 Apr 2013 11:31:19 +0200 From: Gerd Stolpmann To: "Mr. Herr" Cc: caml-list@inria.fr In-Reply-To: <51686208.9020801@freenet.de> (from misterherr@freenet.de on Fri Apr 12 21:35:36 2013) X-Mailer: Balsa 2.4.11 Message-Id: <1365931879.13299.0@samsung> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-Provags-ID: V02:K0:qSLFkAX0Pe5LwIICcj6k2PMoWCKWGI5hJykFz3ctT+7 WomeCp/izDxyX9kdeavgJ5EN1VS6M1l3p+0maIVUNyfUKQPvH3 usWwQTvXGYg6NkljDhhwZlOjnU0X7f5E5jwxshS485wp6JLkEU RSVPjOPlcMHdpOLsH8D/FXzzkXM/00qo4j2rSkGeea6J1aA08c mtTImzT2QYIOZwjfgKLdjZpzprNHgZ6qXSgyIexEwzS7HeQ5sX 0UQ/iqRlcrYMc350ew0K6gInCX80aJCFwVM+/vXfgQGA9CtxYa K6BDGRp5OCqVRCdNGPrN8yGbD97US1FQgBCWeXJbvEDhSBtAPc 9W3tVLiOUTvV4nGGHqHU= Subject: AW: [Caml-list] ocamlfind? how to compile Am 12.04.2013 21:35:36 schrieb(en) Mr. Herr: >=20 > Am 12.04.2013 18:19, schrieb David Allsopp: > > Mr. Herr wrote: > >> I did not understand how the helpers for compilation are supposed=20= =20 > to work. > >> > >> For example I have a script that executes external programs, and=20=20 > needs the > >> Unix module. > >> > >> For script execution I have in the top of my script: #load=20=20 > "unix.cma";; > > Good "trick" for findlib is to add: > > #use "topfind" > > to ~/.ocamlinit (create it, if necessary) and then in future=20=20 > toploops you just say > > #require "unix";; > > instead. Useful when you start using packages which depend on other=20= =20 > packages... > > > >> This must be removed for ocamlc or ocamlopt to work, right?=20=20 > Annoying. > > Yes and no - a way around it is to create a wrapper script for=20=20 > debugging in the toploop which loads all the required libraries (or=20=20 > just have libraries you usually need loaded via .ocamlinit). I think=20= =20 > it's fairly unusual that you have something that's actively intended=20= =20 > for both the toploop *and* separate compilation so it's usually just=20= =20 > a matter of making debugging easier in the toploop with a little=20=20 > script. > > > The response goes to the list... >=20 > I am using a lot of scripting, and you could perfectly well execute=20=20 > the ml scripts > with a #!/usr/bin/ocaml line on top. The idea is that scripts are not=20= =20 > "finished" > (or less finished, and not documented) compared to programs, and that=20= =20 > you read and > adjust the source to your instant need. >=20 > My findings say that scripted ml is only a little bit slower than=20=20 > bytecode, It should be exactly the same speed. The same bytecode interpreter is=20=20 running. > but has a > bigger memory requirement. This matches or is better than a lot of=20=20 > _very_ > popular scripting languages. Additionally you can compile, even to=20=20 > native code. >=20 > If only it was not so unfinished. I am just writing exec functions,=20=20 > it should be > rather easy to capture "Reference to undefined global `Unix' " and=20=20 > repair it. This is just not the way it is supposed to work. OCaml is primarily a=20=20 compiler language, and scripting only an add-on mode, which is mainly=20=20 useful for testing, or as driver, but not really beyond that. The best you can do here with standard utilities is to split your=20=20 script into two files: - One "loader" that contains the scripting directives to load everything, e.g. #use "topfind";; #require "unix";; #use "impl.ml";; - The real implementation (impl.ml) not using any directives. This implementation can be independently compiled with ocamlc or ocamlopt. > Has this not been done?? What is ocamlfind for? ocamlfind is only a wrapper around the compiler, basically it=20=20 translates -package options into the list of compiler switches requires=20= =20 to link a package. ocamlfind cannot change the language. See also the discussion here: https://ocaml.janestreet.com/?q=3Dnode/80 Maybe Martin's utility ocamlscript is also useful for you: http://mjambon.com/ocamlscript.html Gerd >=20 >=20 > /Str. >=20 > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >=20 >=20 --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de Creator of GODI and camlcity.org. Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------=