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 A38897EE51 for ; Fri, 12 Apr 2013 20:54:28 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of misterherr@freenet.de) identity=pra; client-ip=195.4.92.93; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="misterherr@freenet.de"; x-sender="misterherr@freenet.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of misterherr@freenet.de) identity=mailfrom; client-ip=195.4.92.93; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="misterherr@freenet.de"; x-sender="misterherr@freenet.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mout3.freenet.de) identity=helo; client-ip=195.4.92.93; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="misterherr@freenet.de"; x-sender="postmaster@mout3.freenet.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmEBAOdXaFHDBFxdjmdsb2JhbABQgmVXgy6+NIEMFg4BAQEBBw0JCRIFJYIfAQEFI1URCxgCAgUWCwICCQMCAQIBRRMIAQGHfQETA6oxiB0JgTYBiHSBI417FoIYgRMDnQeOGQ X-IPAS-Result: AmEBAOdXaFHDBFxdjmdsb2JhbABQgmVXgy6+NIEMFg4BAQEBBw0JCRIFJYIfAQEFI1URCxgCAgUWCwICCQMCAQIBRRMIAQGHfQETA6oxiB0JgTYBiHSBI417FoIYgRMDnQeOGQ X-IronPort-AV: E=Sophos;i="4.87,464,1363129200"; d="scan'208";a="13056545" Received: from mout3.freenet.de ([195.4.92.93]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Apr 2013 20:54:28 +0200 Received: from [195.4.92.140] (helo=mjail0.freenet.de) by mout3.freenet.de with esmtpa (ID misterherr@freenet.de) (port 25) (Exim 4.80.1 #3) id 1UQj7D-0005B3-1s for caml-list@inria.fr; Fri, 12 Apr 2013 20:54:27 +0200 Received: from localhost ([::1]:56342 helo=mjail0.freenet.de) by mjail0.freenet.de with esmtpa (ID misterherr@freenet.de) (Exim 4.80.1 #3) id 1UQj7C-0005nR-Rs for caml-list@inria.fr; Fri, 12 Apr 2013 20:54:26 +0200 Received: from [195.4.92.10] (port=46724 helo=0.mx.freenet.de) by mjail0.freenet.de with esmtpa (ID misterherr@freenet.de) (Exim 4.80.1 #3) id 1UQj4X-0006fO-Vm for caml-list@inria.fr; Fri, 12 Apr 2013 20:51:42 +0200 Received: from cl-252.ham-02.de.sixxs.net ([2001:6f8:1c00:fb::2]:44181) by 0.mx.freenet.de with esmtpsa (ID misterherr@freenet.de) (TLSv1:DHE-RSA-CAMELLIA256-SHA:256) (port 465) (Exim 4.80.1 #3) id 1UQj4X-0007SR-JM for caml-list@inria.fr; Fri, 12 Apr 2013 20:51:41 +0200 Message-ID: <516857BC.4000909@freenet.de> Date: Fri, 12 Apr 2013 20:51:40 +0200 From: "Mr. Herr" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: caml-list@inria.fr References: <5167325A.2030600@lakaban.net> <51682FE2.60607@freenet.de> <51683FC5.6060504@freenet.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] ocamlfind? how to compile Am 12.04.2013 20:17, schrieb David Allsopp: > Mr. Herr wrote: >> Am 12.04.2013 18:19, schrieb David Allsopp: >>> Mr. Herr wrote: >>>> I did not understand how the helpers for compilation are supposed to >> work. >>>> For example I have a script that executes external programs, and >>>> needs the Unix module. >>>> >>>> For script execution I have in the top of my script: #load >>>> "unix.cma";; >>> Good "trick" for findlib is to add: >>> #use "topfind" >>> to ~/.ocamlinit (create it, if necessary) and then in future toploops >> you just say >>> #require "unix";; >>> instead. Useful when you start using packages which depend on other >> packages... >> >> First try: >> >> I added topfind to .ocamlinit, and in the interactive toplevel I see the >> startup info, and I can enter [ #require "unix";; ], but when I put [ >> #require "unix";; ] into my .ml file I get a syntax error on it: > If you want to use findlib toploop directives in an ML file (i.e. invoked using ocaml Foo.ml) then you have to put [#use "topfind";;] into the .ml file as well (which is obviously only worthwhile if you have a lot of things to load). The script, presumably, /usr/lib64/ocaml/topfind contains the instructions necessary to make #require and so on work and .ocamlinit is only read if you invoke an interactive toploop (i.e. it's not read when you supply an input file on the command line). > >> str@suse122-intel:~/Ocaml/ml> ocaml unix2_exec.ml ls -l b\* Unknown >> directive `require'. >> >> Same error on compile with ocamlc. Sorry, I don't see how this is supposed >> to work. > It was just a tip for using findlib in the toploop! Note that all directives (anything beginning with a '#') are explicitly for ocaml and never ocamlc/ocamlopt. > > Thanks, one little step... /Str.