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 D70C37EE25 for ; Fri, 7 Jun 2013 10:16:50 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of yallop@gmail.com) identity=pra; client-ip=209.85.212.170; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="yallop@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of yallop@gmail.com designates 209.85.212.170 as permitted sender) identity=mailfrom; client-ip=209.85.212.170; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="yallop@gmail.com"; 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@mail-wi0-f170.google.com) identity=helo; client-ip=209.85.212.170; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="postmaster@mail-wi0-f170.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Au0AAGuVsVHRVdSqjWdsb2JhbABZhnW7NnYIFg4BAQEBBwsLCRIGJIIjAQEFIx0BGx0BAwwGBQsNAgImAgIiAREBBQEcBhOHegEDD54Yi3tPgn+EcgoZJw1Yh3QBBQyBGo4MB4JHgRQDlz+PWxYpgn6BODs X-IPAS-Result: Au0AAGuVsVHRVdSqjWdsb2JhbABZhnW7NnYIFg4BAQEBBwsLCRIGJIIjAQEFIx0BGx0BAwwGBQsNAgImAgIiAREBBQEcBhOHegEDD54Yi3tPgn+EcgoZJw1Yh3QBBQyBGo4MB4JHgRQDlz+PWxYpgn6BODs X-IronPort-AV: E=Sophos;i="4.87,820,1363129200"; d="scan'208";a="20800158" Received: from mail-wi0-f170.google.com ([209.85.212.170]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 07 Jun 2013 10:16:50 +0200 Received: by mail-wi0-f170.google.com with SMTP id ey16so1126356wid.1 for ; Fri, 07 Jun 2013 01:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ijH/qnMBbd2oHB7mLI91A/TAkjMG0AjtqztyZTGN2Ho=; b=Ox94sdN14bekEL7p70oAZ56WvM2AyHCniHR9vGT6rCDVZVJIRIjCG0sp8gUng83Jir QK8oPRoR5oC8spAjzEsV6VDrsUsSpzwFN8Sj1Nvh1zjYhO1ig4o04mQjFVaWOoCHwBfl 5859j2QannJcp4DsdlobVFSwXdRUlLltwnj2X37wUfuzXkVljh4oAV721bVvJWnuLOv4 DAkdnLoR+bIlBBCAZl4Tyt786VBuh56mksEE9tu/9OVJTiNo5qUmkQn0NWiQMTQiPwpM R08KyjPtgWiOnzlV4ahK1dpH5argY8Wpg2Yj3e4GXoIzZf8deIOdpUEFNeF1D6La9WVe mS8w== MIME-Version: 1.0 X-Received: by 10.180.9.238 with SMTP id d14mr847278wib.18.1370593010303; Fri, 07 Jun 2013 01:16:50 -0700 (PDT) Received: by 10.216.93.9 with HTTP; Fri, 7 Jun 2013 01:16:50 -0700 (PDT) In-Reply-To: <51B13721.1070101@riken.jp> References: <51B13721.1070101@riken.jp> Date: Fri, 7 Jun 2013 09:16:50 +0100 Message-ID: From: Jeremy Yallop To: Francois Berenger Cc: caml-list@inria.fr Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] ANN: ocaml-ctypes, a library for calling C functions directly from OCaml On 7 June 2013 02:28, Francois Berenger wrote: > How about the cost of exchanging values between C and OCaml? > > Is there a trick in ocaml-ctypes like there is for bigarrays? Array and struct memory in ocaml-ctypes is managed similarly to the way bigarray does things, i.e. objects are allocated on the C heap, so both C and OCaml functions can safely access them without copying. However, there's no special compiler support for ocaml-ctypes as there is for bigarrays, so it's likely that array access will be slower for the moment. Of course, arrays in ocaml-ctypes also have some advantages over bigarrays. For example, they can hold a broader range of data -- structs, pointers, and so on. I'm hoping to add bigarray integration to ocaml-ctypes at some point.