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.1 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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id E6607BBAF for ; Sat, 10 Jan 2009 19:08:40 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.37,244,1231110000"; d="scan'208";a="21293776" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 10 Jan 2009 19:08:40 +0100 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id n0AI8evR026460 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 10 Jan 2009 19:08:40 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvABAApzaEnRVdoKm2dsb2JhbACTUT4BAQEBAQgJCgkRsAOBAosDAQMBA4Vs X-IronPort-AV: E=Sophos;i="4.37,244,1231110000"; d="scan'208";a="19405792" Received: from mail-bw0-f10.google.com ([209.85.218.10]) by mail2-smtp-roc.national.inria.fr with ESMTP; 10 Jan 2009 19:08:39 +0100 Received: by bwz3 with SMTP id 3so25726263bwz.9 for ; Sat, 10 Jan 2009 10:08:39 -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:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=917lN6NysPj8x3VW4vuHSGbhP93ZYu43Ng3vXrZqwL0=; b=unREQrQ8p6WK3RZi8QYODQLiuh8LPskLKzkq/x5n4wMHci/G46pAGcwaNMsJ+mqaKR yZRPL0PmvB6yd1vZ7lerWdrMgQYSzGr72E+BMhVjAPS2zt3vAU+z/Y7w6JjDZVVBTlX8 R/QpSagyyoBaxam4DhqpuTlLuQHDu06hHvXqo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Rc+9fOfxxetEVyEHiNG2CUqtylaB08yLg7iHa9jIVNKOQDYCTeDRSQx1gho8Q6Slor Ox8Gp+plh91xJypTeC2tTFeaKWCjiGDHXnD5pVnD45g1tvrgbxhpwrmsauUXY0Scl0lz HITbsP6rfLlEw14DBs2UBvUA6pat94ZhXvREY= Received: by 10.223.115.12 with SMTP id g12mr19601885faq.92.1231610919170; Sat, 10 Jan 2009 10:08:39 -0800 (PST) Received: by 10.223.108.209 with HTTP; Sat, 10 Jan 2009 10:08:39 -0800 (PST) Message-ID: Date: Sat, 10 Jan 2009 19:08:39 +0100 From: "Ben Jakb" To: matthieu.dubuget@gmail.com, caml-list@inria.fr Subject: Re: [Caml-list] Shared libraries with ocamlopt callable from C (without main())? In-Reply-To: <4968C07F.1020207@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <49670917.3040103@gmail.com> <49688B93.7080803@gmail.com> <4968C07F.1020207@gmail.com> X-Miltered: at concorde with ID 4968E428.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocamlopt:01 callable:01 bug:01 matthieu:01 dubuget:01 matthieu:01 dubuget:01 ml':01 ocaml:01 ocamlopt:01 lib:01 -shared:01 cmx:01 ocamlc:01 gcc:01 > I introduced a bug: the string in the C file is "add_five", while the > registered one in the ml file is "add five". Touch=E9. I suppose I looked to long to this code And yes it works now, thanks ... 2009/1/10 Matthieu Dubuget : > Ben Jakb a =E9crit : >> matthieu, >> thanks for the interesting answer. >> Unfortunately I can't build 'mycamlbuild.ml', and it is a bit too >> advanced for me to understand. > > If you have a > 3.10 version of ocaml, you don't need to compile > yourself myocamlbuild.ml. > > This is done automatically by ocamlbuild. > >> >> Therefore I'll first go with your standard build commands. So - after >> modifing the sources according to your suggestions I run: >> >> BUILD >> ocamlopt -c add5.ml >> ocamlopt -c add5wrapperlib.c >> ocamlopt -o add5lib.native.so -ccopt -shared add5.cmx add5wrapperlib= .o >> ocamlc.opt -ccopt -Iinclude -c main.c >> gcc -o maintest.native main.o -l:add5lib.native.so -L. -Wl,-rpath=3D= . >> >> EXECUTION >> cp add5lib.native.so lib/ >> ./maintest.native >> >> ERROR >> "maintest.native: add5wrapperlib.c:24: add5wrapper: Assertion `cbk' fail= ed. >> Aborted" >> >> This is the referenced line: >> >> $ sed -n 24p add5wrapperlib.c >> CAMLCBK_INIT(cbk, "add_five"); >> >> >> Any ideas what' wrong here? > > Yes ;-) > > This is exactly why i use assert there. > > I introduced a bug: the string in the C file is "add_five", while the > registered one in the ml file is "add five". > > > Hope this helps >