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=0.0 required=5.0 tests=none 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 A8340BC37 for ; Tue, 1 Sep 2009 10:55:32 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApcCAEN+nEqG1L4Ei2dsb2JhbACBU5lUAQEBCgsKGsAmhBoFgVU X-IronPort-AV: E=Sophos;i="4.44,311,1249250400"; d="asc'?scan'208";a="31998255" Received: from briaree.onecert.fr ([134.212.190.4]) by mail2-smtp-roc.national.inria.fr with ESMTP; 01 Sep 2009 10:55:32 +0200 Received: from neree.onecert.fr (thetis.onecert.fr [134.212.178.12]) by briaree.onecert.fr (8.14.3/8.14.3/ONERA-SRI) with ESMTP id n818sqb4004262; Tue, 1 Sep 2009 10:54:52 +0200 Received: from neree.onecert.fr (thetis.antiviral [127.0.0.1]) by neree.onecert.fr (8.14.3/8.14.3/ONERA-SRI) with ESMTP id n818q1JZ005001; Tue, 1 Sep 2009 10:52:01 +0200 Received: from onera.fr (ct-ldtim902h.onecert.fr [134.212.27.183]) by neree.onecert.fr (8.14.3/8.14.3/ONERA-SRI) with ESMTP id n818q19G004998; Tue, 1 Sep 2009 10:52:01 +0200 Date: Tue, 1 Sep 2009 10:56:47 +0200 From: =?iso-8859-1?Q?Pierre-Lo=EFc?= Garoche To: Alain Frisch , Julien Signoles Cc: =?iso-8859-1?Q?Pierre-Lo=EFc?= Garoche , caml-list@yquem.inria.fr, thirioux@enseeiht.fr Subject: Re: [Caml-list] Dynamic loading of native code : what about librairies and packs ? Message-ID: <20090901085647.GF4549@onera.fr> References: <49D243B0.6020103@onera.fr> <49D24603.7060509@frisch.fr> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pyE8wggRBhVBcj8z" Content-Disposition: inline In-Reply-To: <49D24603.7060509@frisch.fr> X-Operating-System: Linux 2.6.28-15-generic X-Face: 82XuMp7$9Y:Cn=,lv}a0/}C}]7#l(?6y>g:~_tN`=J8'$uqyPjR8$s,/v8u(T97O-`R( ^vg=2o;^0X00-u^T8NX$Upc#L]zZFC:xH\(feHbj,[Mz(Sy15Lmo1DWVFo8f$ke?qkKJ "En~Gy&cJ]#mC$y/-'.BQ>ie^ X-GPG-Key: http://www.onera.fr/staff/pierre-loic-garoche/docs/0xE4E23518.asc X-GPG-Fingerprint: 0B6A E123 37FE 1BA0 40B0 0765 47CE 9FAD E4E2 3518 X-Accept-Language: en,fr User-Agent: Mutt/1.5.18 (2008-05-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (briaree.onecert.fr [134.212.190.4]); Tue, 01 Sep 2009 10:54:52 +0200 (CEST) X-Virus-Scanned: clamav-milter 0.95.1 at briaree.onecert.fr X-Virus-Status: Clean X-Spam: no; 0.00; librairies:01 ocaml:01 lib:01 mylib:01 lib:01 dynlink:01 loadfile:01 ocamlopt:01 myprog:01 dynlink:01 cmxa:01 mylib:01 hashtbl:01 hashtbl:01 ocamlopt:01 X-Attachments: type="application/pgp-signature" name="signature.asc" --pyE8wggRBhVBcj8z Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Alain, Julien and all other Ocaml list members, I am still having some problems with the dynamic loading of native code. Al= low me to give you an extremely simple example to illustrate my problem. I = hope you can clarify my understanding of it. My problem concerns the dynamic loading of native code where the dynamic co= de loaded depends on another library. Basically there are three files:=20 - main.ml, dynamically loading the plugin - plugin.ml, the loaded code that depends on the external lib - mylib.ml, the external lib /////// main.ml: let _ =3D print_string "main\n" let _ =3D Dynlink.loadfile "MyPlugin.cmxs" compiled with ocamlopt -o MyProg dynlink.cmxa main.ml /////// mylib.ml: let _ =3D print_string "mylib\n" let myval : (int , int) Hashtbl.t =3D Hashtbl.create 13 compiled with ocamlopt -a -linkall -o mylib.cmxa mylib.ml ////// plugin.ml: let _ =3D print_string "plugin\n" let cst =3D Mylib.myval compiled and linked to build a shared library with ocamlopt -shared -linkall -o MyPlugin.cmxs mylib.cmxa plugin.ml Running it gives me the following error error loading shared library: blabla/MyPlugin.cmxs: undefined symbol: camlH= ashtbl__create_79 Remark1 : Of course, building a standalone plugin works: ocamlopt -o PluginSelf mylib.cmxa plugin.cmx Remark2: If I don't rely on an external module and replace myval by an inte= ger or any other self defined type value, it works as well. Remark3: The linkall option does not seems to have an impact on such simple= example. Question: How should I link it to rely on external libraries and produce a = valid MyPlugin.cmxs ? Any hint or comment will be greatly appreciated ! Best regards, pl --=20 Pierre-Lo=EFc Garoche pierre-loic.garoche@onera.fr http://www.onera.fr/staff/pierre-loic-garoche/ --pyE8wggRBhVBcj8z Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkqc4c8ACgkQR86freTiNRhFMACgyo18mQpl2z8jIC/A1E8LKqTy 0oMAoNWV2FlAAnhCjlehqHQprnRsfg9z =296r -----END PGP SIGNATURE----- --pyE8wggRBhVBcj8z--