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 p8EGupqP029592 for ; Wed, 14 Sep 2011 18:56:51 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoMEAAjccE6K54gDgWdsb2JhbABBpWKBexQBARYmJoFTAQEFMgFFARALGAkWDwkDAgECAUUGDQEHAQG9LoZuBJM/hRuMDA X-IronPort-AV: E=Sophos;i="4.68,381,1312149600"; d="scan'208";a="109080769" Received: from rouge.crans.org ([138.231.136.3]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 14 Sep 2011 18:56:45 +0200 Received: from localhost (localhost.crans.org [127.0.0.1]) by rouge.crans.org (Postfix) with ESMTP id 8B34A861F; Wed, 14 Sep 2011 18:56:44 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at crans.org Received: from rouge.crans.org ([10.231.136.3]) by localhost (rouge.crans.org [10.231.136.3]) (amavisd-new, port 10024) with LMTP id YHRKUQYCs+cQ; Wed, 14 Sep 2011 18:56:44 +0200 (CEST) Received: from [152.81.12.138] (fleur.loria.fr [152.81.12.138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by rouge.crans.org (Postfix) with ESMTPSA id 204E785D5; Wed, 14 Sep 2011 18:56:41 +0200 (CEST) Message-ID: <4E70DCC4.1030102@glondu.net> Date: Wed, 14 Sep 2011 18:56:36 +0200 From: =?ISO-8859-1?Q?St=E9phane_Glondu?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Thunderbird/3.1.13 MIME-Version: 1.0 To: Romain Bardou CC: jeremie@dimino.org, OCaml List References: <4E70C18F.3040304@lri.fr> <83695D27-A767-438A-B909-6864D1A655FE@googlemail.com> <4E70CEAE.8030807@lri.fr> <4E70D140.8030507@glondu.net> <4E70D26A.10801@lri.fr> <4E70D789.6030309@glondu.net> <4E70D958.4030601@lri.fr> In-Reply-To: <4E70D958.4030601@lri.fr> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] Link a .so/.dll dynamically On 09/14/2011 06:42 PM, Romain Bardou wrote: >>> Thanks, this solves the "native" part of my problem ! Now I need to >>> figure out how to link this .so file. >> >> You mean, the equivalent of dllmylib.so? There is no such file in native >> code: mylib.cmxs will contain the contents of mylib.cmxa and wrapper.o. > > No I mean the driver DLL for which Mylib is the binding. File > dllmylib.so is linked correctly, but binding.c includes api.h, which is > implemented in api.so, so I need to link with api.so as well. The whole > point of my original question is: how can I design the program such that > this api.so is loaded dynamically, because the user may want to choose a > different driver everytime, or even change driver during execution. That would be a -cclib option passed to ocamlmklib. It embeds a -lXXX option in the .cmxa that should be visible with a recent version of ocamlobjinfo. You can check the result by running ldd on the .cmxs file. Cheers, -- Stéphane