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=1.8 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 C1F1FBBAF for ; Sat, 10 Jan 2009 16:36:44 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.37,244,1231110000"; d="scan'208";a="19401767" Received: from concorde.inria.fr ([192.93.2.39]) by mail2-smtp-roc.national.inria.fr with ESMTP; 10 Jan 2009 16:36:44 +0100 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id n0AFahuM024402 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 10 Jan 2009 16:36:44 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4BAGtPaEnRVdoKm2dsb2JhbACTUT4BAQEBAQgJCgkRsCEIeosXAQMBA4VsgiQ X-IronPort-AV: E=Sophos;i="4.37,244,1231110000"; d="scan'208";a="21289708" Received: from mail-bw0-f10.google.com ([209.85.218.10]) by mail3-smtp-sop.national.inria.fr with ESMTP; 10 Jan 2009 16:36:43 +0100 Received: by bwz3 with SMTP id 3so25617492bwz.9 for ; Sat, 10 Jan 2009 07:36:42 -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:cc:subject:references:in-reply-to :x-enigmail-version:openpgp:content-type:content-transfer-encoding; bh=ojr4tQpaiVut5rSFKPuX7YWuFPDEDzV2EvHQE4nX+Jo=; b=PcSsThyUvbtFvwQKsOEMbrJclsIMZjzYVnRgmuquxqac4rlDnV/K/Mm5OHk/HUJrsH 8YYNeNtM3iy4O8KjhGMYzxWxJHVUPFI8mUoqpwirB9R3jtsei7XgCfjOePiZ+VSgKm/c oaF96+rUsMj2Ymmi8pvXoM34EZt2VmYm6IDPw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:openpgp:content-type :content-transfer-encoding; b=UscAHDd6LmzeQeBOXBgPTjoxo8wm7dDV6A2zkkLYw3kKBzguGEJiXVOho2mRSc0odh 2HfOI/CiO63ZJl2xSNqrdfpWGbq00rE07JItBO5Qfw00ACybUe5OFN2nqy2F0Wrag7GM ZqmTGyGQ5hIsMqrTjHcyvZNt9FHJNFNFA5X6g= Received: by 10.103.220.18 with SMTP id x18mr9633890muq.38.1231601802309; Sat, 10 Jan 2009 07:36:42 -0800 (PST) Received: from ?192.168.1.10? (8.75.197-77.rev.gaoland.net [77.197.75.8]) by mx.google.com with ESMTPS id j6sm7249660mue.59.2009.01.10.07.36.33 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 10 Jan 2009 07:36:33 -0800 (PST) Message-ID: <4968C07F.1020207@gmail.com> Date: Sat, 10 Jan 2009 16:36:31 +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 Cc: Ben Jakb Subject: Re: [Caml-list] Shared libraries with ocamlopt callable from C (without main())? References: <49670917.3040103@gmail.com> <49688B93.7080803@gmail.com> In-Reply-To: X-Enigmail-Version: 0.95.0 OpenPGP: id=F60AB8F5 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 4968C08B.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 ml':01 ocaml:01 ocamlopt:01 lib:01 -shared:01 cmx:01 ocamlc:01 gcc:01 lib:01 Ben Jakb a écrit : > 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=. > > EXECUTION > cp add5lib.native.so lib/ > ./maintest.native > > ERROR > "maintest.native: add5wrapperlib.c:24: add5wrapper: Assertion `cbk' failed. > 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