From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p0HC07bB016626 for ; Mon, 17 Jan 2011 13:00:08 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUAAEu+M03RVaC0k2dsb2JhbACkUggVAQEBAQkJCgkRBCCoO5dShVAEhHCGLw X-IronPort-AV: E=Sophos;i="4.60,332,1291590000"; d="scan'208";a="87110420" Received: from mail-gy0-f180.google.com ([209.85.160.180]) by mail2-smtp-roc.national.inria.fr with ESMTP; 17 Jan 2011 13:00:07 +0100 Received: by gya6 with SMTP id 6so2431851gya.39 for ; Mon, 17 Jan 2011 04:00:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.105.231 with SMTP id k67mr7869337yhg.5.1295265605336; Mon, 17 Jan 2011 04:00:05 -0800 (PST) Received: by 10.146.82.1 with HTTP; Mon, 17 Jan 2011 04:00:05 -0800 (PST) X-Originating-IP: [128.12.240.155] In-Reply-To: <20110117111304.GV4195@localhost> References: <20110117111304.GV4195@localhost> Date: Mon, 17 Jan 2011 04:00:05 -0800 Message-ID: From: beo wulf To: Guillaume Yziquel , caml-list@yquem.inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p0HC07bB016626 Subject: Re: [Caml-list] boostbind/pythonbind/luabind for ocaml? > Le Monday 17 Jan 2011 à 02:19:39 (-0800), beo wulf a écrit : >> Hi! >> >>   Is there anything like luabind or pythonbind for Ocaml? Basically, it's >> http://www.rasterbar.com/products/luabind/docs.html#hello-world >>   a really convenient way to bind class member / functions to another language. > > For Python, there are PyCaml and my own stuff. PyCaml is the most > supported, as long as you take Thomas Fischbacher's version and not the > outdated version from Art Yerkes. I explained poorly. I don't want to bind lua or python to Ocaml. I want to bind C++ to ocaml. > For C, I'd suggest using encapsulate.macro.c from my OCaml-StdC. For > C++, things are somewhat awkward. I've made a tentative binding to Boost > stuff, but not really usable. The biggest issue is that C++ is more > static when it comes to templates than OCaml, and OCaml is not dynamic > enough as Python to cope for C++'s staticness. Can you expand on C++'s staticness, and why OCaml is not dynamic enough for it? Luabind can't bind entire templates -- it can only bind instances of templates. I'm perfectly happy accepting this lmitation, i.e. having to have separte: std::vector std::vector std::vector > So for C++, you're almost better off making your bindings yourself. Binding a piece of code from C++ to anotehr langauge involves 3 steps (1) template magic to get the type of the member/function (2) some sort of reference counting (3) generating the code for the binding (1) & (2) is already provided by pythonbind/luabind/slb The question is (3) ... which I think can be automated once. > > And BTW, my codes do not work anymore because I've made big underlying > changes that I haven't found the time to push forward. > > In a nutshell, for C++, it's hand-crafted. For Python, there's PyCaml. > > -- >     Guillaume Yziquel > http://yziquel.homelinux.org >