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 9FC9E7FA83 for ; Mon, 10 Apr 2017 14:55:57 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=paul.lachat@edu.univ-fcomte.fr; spf=SoftFail smtp.mailfrom=paul.lachat@edu.univ-fcomte.fr; spf=None smtp.helo=postmaster@ufc-sortie.univ-fcomte.fr Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of paul.lachat@edu.univ-fcomte.fr) identity=pra; client-ip=194.57.91.199; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="paul.lachat@edu.univ-fcomte.fr"; x-sender="paul.lachat@edu.univ-fcomte.fr"; x-conformance=sidf_compatible Received-SPF: SoftFail (mail2-smtp-roc.national.inria.fr: domain of paul.lachat@edu.univ-fcomte.fr is inclined to not designate 194.57.91.199 as permitted sender) identity=mailfrom; client-ip=194.57.91.199; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="paul.lachat@edu.univ-fcomte.fr"; x-sender="paul.lachat@edu.univ-fcomte.fr"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@ufc-sortie.univ-fcomte.fr) identity=helo; client-ip=194.57.91.199; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="paul.lachat@edu.univ-fcomte.fr"; x-sender="postmaster@ufc-sortie.univ-fcomte.fr"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AohcuxhTGjAS+1TKMPcHjW6efcNpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa6yZxON2/xhgRfzUJnB7Loc0qyN4vymATRIyK3CmUhKSIZLWR4BhJ?= =?us-ascii?q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7KrVCH/OcvI+2VaI8RuTb9MOQl6uX1?= =?us-ascii?q?jX45nF8dZbOm0YEWaHC+BPRmIl+WbWDigtcbQi82uV81RenuzVmDSiJ7ZnCoXq?= =?us-ascii?q?t66CtoJpihCNLbT52pxriI1yeyArVban0AF1aNDzLmfIKBR/pKZjjBcYdajjUY?= =?us-ascii?q?WO35GMca3ha0uVqixg=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0BAAQA+gOtYmMdbOcJdSQYMgkOBRoELB?= =?us-ascii?q?wGDXosGkDSYBSyFeINdQxQBAQEBAQEBAQEBARIBAQEBAQgLCwYoL0IOgWMggmw?= =?us-ascii?q?EZAEMJRkCW4oqCphbkAiBbDqLFYheiASCOoJfBYksk0+HAI4tgQuNYpQANoEmX?= =?us-ascii?q?1KECwEBCAJUgXFzgymFKQGBDAEBAQ?= X-IPAS-Result: =?us-ascii?q?A0BAAQA+gOtYmMdbOcJdSQYMgkOBRoELBwGDXosGkDSYBSy?= =?us-ascii?q?FeINdQxQBAQEBAQEBAQEBARIBAQEBAQgLCwYoL0IOgWMggmwEZAEMJRkCW4oqC?= =?us-ascii?q?phbkAiBbDqLFYheiASCOoJfBYksk0+HAI4tgQuNYpQANoEmX1KECwEBCAJUgXF?= =?us-ascii?q?zgymFKQGBDAEBAQ?= X-IronPort-AV: E=Sophos;i="5.37,182,1488841200"; d="scan'208,217";a="268487650" Received: from ufc-sortie.univ-fcomte.fr ([194.57.91.199]) by mail2-smtp-roc.national.inria.fr with ESMTP; 10 Apr 2017 14:55:56 +0200 Received: from ufc204.univ-fcomte.fr (ufc204.univ-fcomte.fr [194.57.91.204]) by ufc-sortie.univ-fcomte.fr (Postfix) with ESMTP id 9D64C60657 for ; Mon, 10 Apr 2017 14:55:56 +0200 (CEST) Received: from zstore04.univ-fcomte.fr (localhost.localdomain [127.0.0.1]) by ufc204.univ-fcomte.fr (Postfix) with ESMTP id 737619107 for ; Mon, 10 Apr 2017 14:55:56 +0200 (CEST) Date: Mon, 10 Apr 2017 14:55:56 +0200 (CEST) From: paul.lachat@edu.univ-fcomte.fr To: caml-list@inria.fr Message-ID: <1200659935.12485491.1491828956000.JavaMail.zimbra@edu.univ-fcomte.fr> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_12485490_16036198.1491828955999" X-Originating-IP: [194.167.45.25] X-Mailer: Zimbra 8.6.0_GA_1200 (ZimbraWebClient - FF52 (Linux)/8.6.0_GA_1200) Thread-Topic: Compile and link program who use Toploop Thread-Index: K6Vf3G6RtTmtO8R3/igIDEQjdCn1Kw== Subject: [Caml-list] [Question] Compile and link program who use Toploop ------=_Part_12485490_16036198.1491828955999 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Hello, I would like to use functions of the toplevel (https://github.com/ocaml/ocaml/blob/trunk/toplevel/toploop.ml) I've tried to compile this code just to understand how I can link the toploop file with my program : ____ test.ml : let _ = let lb = Lexing.from_string "let x = 10;;" in let ppf = Format.std_formatter in try List.iter (fun phr -> if not (Toploop.execute_phrase false ppf phr) then raise Exit) (!Toploop.parse_use_file lb) with | Exit -> () | x -> Errors.report_error ppf x ____ I've test : [-] ocamlc -I +compiler-libs -o test.out test.ml [*] File "test.ml", line 1: Error: Error while linking test.cmo: Reference to undefined global `Toploop' ____ So I create test.cmo with : [-] ocamlc -I +compiler-libs -c test.ml, but I don't know where to find "toploop.cmo". I use Ocaml 4.03.0 with Opam. In ".opam/4.03.0/lib/ocaml/compiler-libs/" I have "toploop.cmi", "toploop.cmti" and "toploop.cmt", but no "toploop.cmo" to link to the program. I've seen this file ".opam/4.03.0/lib/ocaml/compiler-libs/ocamltoplevel.cma", but I don't know if it's usefull. I think it's possible to use Toploop. In this post, https://stackoverflow.com/questions/33291754/eval-a-string-in-ocaml, they seems to have find a way to compile a program who use Toploop. But I would like, if possible, to avoid dependecys like ocamlbuild. ____ So, I would like to know how I can compile this program ? ------=_Part_12485490_16036198.1491828955999 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hello,

I would like to use functions= of the toplevel (https://github.com/ocaml/ocaml/blob/trunk/toplevel/toploo= p.ml)

I've tried to compile this code just to understand how I can l= ink the toploop file with my program :
____
test.ml :

let _ = =3D
    let lb =3D Lexing.from_string "let x =3D 10;;" in=
    let ppf =3D Format.std_formatter in
  &= nbsp; try
    List.iter
     = (fun phr ->
        if not (Toplo= op.execute_phrase false ppf phr) then raise Exit)
   &nbs= p;  (!Toploop.parse_use_file lb)
    with
 &= nbsp;  | Exit -> ()
    | x -> Errors.report_e= rror ppf x

____

I've test :

[-] ocamlc -I +compiler-li= bs -o test.out test.ml

[*] File "test.ml", line 1:
  &n= bsp; Error: Error while linking test.cmo:
    Reference t= o undefined global `Toploop'

____

So I create test.cmo with :=
[-] ocamlc -I +compiler-libs -c test.ml, but I don't know where = to find "toploop.cmo".

I use Ocaml 4.03.0 with Opam.
In ".opam/4.= 03.0/lib/ocaml/compiler-libs/" I have "toploop.cmi", "toploop.cmti" and "to= ploop.cmt", but no "toploop.cmo" to link to the program.

I've seen t= his file ".opam/4.03.0/lib/ocaml/compiler-libs/ocamltoplevel.cma", but I do= n't know if it's usefull.

I think it's possible to use Toploop. In t= his post, https://stackoverflow.com/questions/33291754/eval-a-string-in-oca= ml, they seems to have find a way to compile a program who use Toploop. But= I would like, if possible, to avoid dependecys like ocamlbuild.
<= div>
____
=

So, I would like to know how I can compile this program ?
= ------=_Part_12485490_16036198.1491828955999--