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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id A6EEE7FCCB for ; Tue, 28 Apr 2015 00:03:19 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=pra; client-ip=85.233.204.164; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=mailfrom; client-ip=85.233.204.164; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mx20.yaziba.net) identity=helo; client-ip=85.233.204.164; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="postmaster@mx20.yaziba.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CcAQAwsT5VnKTM6VVcg19cgxrEfIYIAoE1OxEBAQEBAQEBEQEBAQEBCAsJCSEuhCEBAQQjBBFAEQsYAgIFFgsCAgkDAgECAUUGAQwIAQGIK7MtlBkBAQEBBgEBAQEBARyBIYoXhQyCaIFFAQSVVoY4hzmEZolAAoQZbYJEAQEB X-IPAS-Result: A0CcAQAwsT5VnKTM6VVcg19cgxrEfIYIAoE1OxEBAQEBAQEBEQEBAQEBCAsJCSEuhCEBAQQjBBFAEQsYAgIFFgsCAgkDAgECAUUGAQwIAQGIK7MtlBkBAQEBBgEBAQEBARyBIYoXhQyCaIFFAQSVVoY4hzmEZolAAoQZbYJEAQEB X-IronPort-AV: E=Sophos;i="5.11,660,1422918000"; d="scan'208";a="113727693" Received: from mx20.yaziba.net ([85.233.204.164]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 28 Apr 2015 00:03:18 +0200 Received: from mta10.int.yaziba.net (unknown [10.4.20.30]) by mx20.yaziba.net (mx10.yaziba.net) with ESMTP id 8DE5B3FFD; Tue, 28 Apr 2015 00:03:18 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mta10.int.yaziba.net (Postfix) with ESMTP id C4009CA653; Tue, 28 Apr 2015 00:03:18 +0200 (CEST) X-Virus-Scanned: amavisd-new at mta10.int.yaziba.net Received: from mta10.int.yaziba.net ([127.0.0.1]) by localhost (mta10.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CNyg_x76mv4N; Tue, 28 Apr 2015 00:03:18 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mta10.int.yaziba.net (Postfix) with ESMTP id 9EDB6CA65C; Tue, 28 Apr 2015 00:03:18 +0200 (CEST) X-Virus-Scanned: amavisd-new at mta10.int.yaziba.net Received: from mta10.int.yaziba.net ([127.0.0.1]) by localhost (mta10.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Z9xsCi66NLP3; Tue, 28 Apr 2015 00:03:18 +0200 (CEST) Received: from [192.168.1.14] (APuteaux-655-1-5-226.w86-195.abo.wanadoo.fr [86.195.252.226]) by mta10.int.yaziba.net (Postfix) with ESMTPSA id 778E1CA653; Tue, 28 Apr 2015 00:03:18 +0200 (CEST) Message-ID: <553EB228.9080801@frisch.fr> Date: Tue, 28 Apr 2015 00:03:20 +0200 From: Alain Frisch User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Helmut Brandl , caml-list@inria.fr References: <553E9CD0.5040203@gmx.net> In-Reply-To: <553E9CD0.5040203@gmx.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-DRWEB-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrfeektddrieekgddtkecutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepkfffhfgfggfvufhfjggtgfesthejrgdttdefjeenucfhrhhomheptehlrghinhcuhfhrihhstghhuceorghlrghinhesfhhrihhstghhrdhfrheqnecuffhomhgrihhnpehnohguvghjshdrohhrgh X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht X-Validation-by: alain@frisch.fr Subject: Re: [Caml-list] js_of_ocaml with node On 27/04/2015 22:32, Helmut Brandl wrote: > Hello all, > > I am currently writing a software package in ocaml and I want to be able > to compile it from ocaml to javascript to be able to run it under > nodejs. I have found js_of_ocaml which seems to do a rather good job in > compiling from bytecode to javascript. > > I achieved the compilation to javascript which can run under nodejs as > long as I don't use anything from the unix library. Unfortunately I need > two functions from the unix library: 1. Get the last modification time > of a file. 2. Create a directory. I cannot find anything equivalent in > the standard library. You need to define bindings to node.js' "fs" API: https://nodejs.org/api/fs.html It should be possible to implement a subset of the Unix module through this API, or just to expose the few functions you would need. For instance, with the gen_js_api I announced earlier today, binding the synchronous mkdir function would look like: val mkdir: string -> int -> unit [@@js.global "fs.mkdirAsync"] Alain