From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q3QCNDZc029365 for ; Thu, 26 Apr 2012 14:23:13 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoBAA09mU/B/BfXkWdsb2JhbABEgx2rEINAAQEBAQkLCwcUAySCCQEBBAE4QQULCxgJJQ8CRgYNAQcBAYgECbsKkGUElX2FdI02 X-IronPort-AV: E=Sophos;i="4.75,486,1330902000"; d="scan'208";a="141705505" Received: from msa06.smtpout.orange.fr (HELO msa.smtpout.orange.fr) ([193.252.23.215]) by mail4-smtp-sop.national.inria.fr with ESMTP; 26 Apr 2012 14:23:08 +0200 Received: from [192.168.1.105] ([86.195.11.98]) by mwinf5d23 with ME id 2cP51j00726vTEW03cP5tp; Thu, 26 Apr 2012 14:23:06 +0200 Message-ID: <4F993E2B.70700@frisch.fr> Date: Thu, 26 Apr 2012 14:23:07 +0200 From: Alain Frisch User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: Xavier ALLAMIGEON CC: caml-list@inria.fr References: <4F99003B.9070001@inria.fr> <4F990869.5050105@etorok.net> <4F991E88.5060402@inria.fr> In-Reply-To: <4F991E88.5060402@inria.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] static C library of wrappers: compilation issues On 04/26/2012 12:08 PM, Xavier ALLAMIGEON wrote: > What do you mean exactly? I imagine that test.o needs some functions of > the libhello_world.a. But I don't see why libasmrun would need some > other functions of libhello_world... Well, this is the case. libasmrun contains the runtime system for OCaml code (compiled with ocamlopt) and, as you can see in the error message from the linker, it depends on symbols provided by the OCaml program. For instance, the garbage collector (in libasmrum) needs to find special symbols, to locate some data structures (in libhello_world.a) created by the compiler. > What about the following alternative where libasmrun is directly > appended to the .a file? > cp "`ocamlc -where`"/libasmrun.a libhello_world.a > ar rcs libhello_world.a ml_code.obj.o c_code.o > gcc -o test -L. -L"`ocamlc -where`" test.c -lhello_world -lm -ldl This looks fine to me. -- Alain