From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.5 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 0EF00BBAF for ; Fri, 9 Jan 2009 09:21:47 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.37,238,1231110000"; d="scan'208";a="19339003" Received: from discorde.inria.fr ([192.93.2.38]) by mail2-smtp-roc.national.inria.fr with ESMTP; 09 Jan 2009 09:21:46 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id n098LkuV016283 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 9 Jan 2009 09:21:46 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjsBAG+YZknRVdsUmGdsb2JhbACTUz4BAQEBAQgJDAcRrk0IeYs1AQMBA4VxgiE X-IronPort-AV: E=Sophos;i="4.37,238,1231110000"; d="scan'208";a="22203352" Received: from mail-ew0-f20.google.com ([209.85.219.20]) by mail1-smtp-roc.national.inria.fr with ESMTP; 09 Jan 2009 09:21:46 +0100 Received: by ewy13 with SMTP id 13so11981900ewy.9 for ; Fri, 09 Jan 2009 00:21:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=Isr4nuMm3N4J2zJ37zY2zTg3REAjC5MXoS8/OoNQz0A=; b=WMhWIW3xs5J+ApFuyq84Fck0Xa+lsBdA73174kRxCuKKo+yNQ8tnzG+9bm4GqjCbMY IxI7/AKKtUSMMKR7hsXEiZNJFGXUZZAnmANNdOP1qdxlvXs0ibMMKRkoo6mx0Dxebhoh LH6ffPWBlJWNclqG+OS7IR7kF3vFKZX/0TFhs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; b=q3D8MiYa5b3uAtGIJKK9gvsDKpFHs+JBAsgZjbQNeI14OPbdUTIANo6+CvGHkegToG iscmcZ0oLSiV8y/U0tKlcOiwzlfspLMQirN6OLK2foBgYJ3DQC8VJcKpgloevvqoxHA0 P2q/DClKsVSeahpjaWxw9kHKRgUcztN0JcoGk= Received: by 10.210.58.13 with SMTP id g13mr10705133eba.187.1231489306084; Fri, 09 Jan 2009 00:21:46 -0800 (PST) Received: from ?192.168.0.102? (papillon.metalscan.fr [212.73.210.234]) by mx.google.com with ESMTPS id 28sm5221138eyg.14.2009.01.09.00.21.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 09 Jan 2009 00:21:45 -0800 (PST) Message-ID: <49670917.3040103@gmail.com> Date: Fri, 09 Jan 2009 09:21:43 +0100 From: Matthieu Dubuget Reply-To: matthieu.dubuget@gmail.com User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] Shared libraries with ocamlopt callable from C (without main())? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Miltered: at discorde with ID 4967091A.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; matthieu:01 dubuget:01 matthieu:01 dubuget:01 ocamlopt:01 callable:01 ocaml:01 ocaml:01 caml-list:01 api:02 api:02 library:03 library:03 problem:05 shared:06 Ben Aurel a =E9crit : > I'm thinking about the possibility to use OCaml as an extension > language. If I wanted to call a OCaml function from langX I had to use > a C wrapper. > > langX -> ( C API of langX | C Wrapper | C API of OCaml ) -> OCaml > =20 Yes > But could somebody tell me if ( and maybe how ) this can be done. I mad= e some attempts, but > there is always a main() function involved. But this C wrapper would be= a shared library. > =20 Exactly. You can deliver your OCaml code as shared library, and then call it from any language that can call a shared library. Could you point out what problem you faced? Salutations Matt