From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 C94D87EE25 for ; Tue, 5 Nov 2013 12:08:39 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of jp.deplaix@gmail.com) identity=pra; client-ip=74.125.82.175; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jp.deplaix@gmail.com"; x-sender="jp.deplaix@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of jp.deplaix@gmail.com designates 74.125.82.175 as permitted sender) identity=mailfrom; client-ip=74.125.82.175; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jp.deplaix@gmail.com"; x-sender="jp.deplaix@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-we0-f175.google.com) identity=helo; client-ip=74.125.82.175; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jp.deplaix@gmail.com"; x-sender="postmaster@mail-we0-f175.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArICACXReFJKfVKvlGdsb2JhbABagz+DW7tnS4EnFg4BAQEBBwsLCRIqgiUBAQUjHQEbHAEBAwwGBQsDCgICBRYLAgIJAwIBAgEREQEFARwGDQEHAQGHagEDDwQBCJ9pjARTgwmEHQoZJw1kiQEBAQQMgR2LWIJYB4JrgUQDmAqGPYlgQYRS X-IPAS-Result: ArICACXReFJKfVKvlGdsb2JhbABagz+DW7tnS4EnFg4BAQEBBwsLCRIqgiUBAQUjHQEbHAEBAwwGBQsDCgICBRYLAgIJAwIBAgEREQEFARwGDQEHAQGHagEDDwQBCJ9pjARTgwmEHQoZJw1kiQEBAQQMgR2LWIJYB4JrgUQDmAqGPYlgQYRS X-IronPort-AV: E=Sophos;i="4.93,639,1378850400"; d="scan'208";a="33811569" Received: from mail-we0-f175.google.com ([74.125.82.175]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 05 Nov 2013 12:08:39 +0100 Received: by mail-we0-f175.google.com with SMTP id t61so3336832wes.34 for ; Tue, 05 Nov 2013 03:08:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=VmeeqWq06z6pX4Hzajl34cicj/2fZG3hIgA2v+XeZ2I=; b=A4N6ldi7DduocbjEgfBb+/UpGobYjK7yNQ2Lk1Q2SfpqMkaRW5xdtTMqTvIJZaCKOg JACCvHPTOxe43dlvAqFUhO4FJx7VdSa0vTRJnnzkM4pFlphBkWstDz774SO48PSf12J3 Lk25Ud7fkOSCa339CWTEjq7rfMFXHFDgU02YuDLAiW/mp3gZoVirp4+sAmnsmqMkIHdt TgpHe/fd/Z7KzfQQTdC1PxoEsGhnht/Y7MDWWJn6Igy8YuZNDxBcoQXjdaG/vGKIvTtA 2+PD4j4Vm5xCBBkDsTyUavds+9dd0M6um2iSHHu3KmFd98sXjNdE86U1/SoY41OYIPI8 BdIQ== X-Received: by 10.180.160.165 with SMTP id xl5mr15964045wib.48.1383649719074; Tue, 05 Nov 2013 03:08:39 -0800 (PST) Received: from [192.168.1.23] (AMontsouris-652-1-188-204.w90-24.abo.wanadoo.fr. [90.24.211.204]) by mx.google.com with ESMTPSA id w10sm13077333wia.4.2013.11.05.03.08.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Nov 2013 03:08:38 -0800 (PST) Message-ID: <5278D1D1.4060009@gmail.com> Date: Tue, 05 Nov 2013 12:09:05 +0100 From: Jacques-Pascal Deplaix User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Peter Zotov CC: caml-list@inria.fr References: In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] LLVM OCaml bindings Hi, I'm using LLVM for the compiler of my toy language Cervoise (link below). First, before I started it, I heard from a friend that the official LLVM binding can segfaults so I didn't want to use it [1]. I tried to create my own binding that produces LLVM-IR but there were bugs (the interface didn't seems good). So I tried the official binding. Like expected, it segfaults and has several bugs and misses features [2] :/ Then, I tried to reproduce the interface of the LLVM binding but with types parameters for lltype and llvalue to know what LLVM types can be inserted for a function (the main cause of segfault), but it was very very painful since we have to separate impossible cases and the type errors (with recursive polymorphic variants) are awesome (irony) [3]. So now I have again my own binding that produces LLVM-IR but this time with the same interface than the official binding, and it works pretty well [4]. As a conclusion, don't try to add a type parameter like I did (however, you can try other ways), it would be a waste of time. [1]: We tried to fix this by starting TyLLVM (but it's not satisfying and far to be finished): https://bitbucket.org/dinosaure/tyllvm [2]: I have done several issues on the LLVM bug tracker, but apart from segfaults and bugs when trying to use LLVM_bitwriter, the missed feature is, IMHO, the possibility to get a string that contains the LLVM-IR code, and not just print it. [3]: https://github.com/jpdeplaix/cervoise/blob/jeSuisFou/src/LLVM.mli [4]: https://github.com/jpdeplaix/cervoise/blob/master/src/LLVM.ml On 11/05/2013 05:23 AM, Peter Zotov wrote: > Hello folks, > > I'm currently working on improving LLVM's OCaml bindings. > There's been quite some progress so far[1]; the only major > areas pending are AOT code generation and MCJIT support. > > I would be very interested to hear how are you using these > bindings, or suggestions for future development. In particular, > I'd like to understand the impact of breaking the API. > > [1]: https://github.com/llvm-mirror/llvm/commits/master/bindings/ocaml >