From mboxrd@z Thu Jan 1 00:00:00 1970 X-Sympa-To: caml-list@inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p8F9OUWa005694 for ; Thu, 15 Sep 2011 11:24:30 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsBAGzDcU5XYriemWdsb2JhbABCpVGCEAEBAQEBCAsLBxQmgVMBAQQBMgEFQAEQCxgJFg8JAwIBAgFFBg0BBwKHcwK1K4Z0BJkCi3E X-IronPort-AV: E=Sophos;i="4.68,386,1312149600"; d="scan'208";a="119917604" Received: from 11.mo3.mail-out.ovh.net (HELO mo3.mail-out.ovh.net) ([87.98.184.158]) by mail1-smtp-roc.national.inria.fr with ESMTP; 15 Sep 2011 11:24:25 +0200 Received: from mail91.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo3.mail-out.ovh.net (Postfix) with SMTP id 3B2DA10203B7 for ; Thu, 15 Sep 2011 11:25:47 +0200 (CEST) Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 15 Sep 2011 11:24:24 +0200 Received: from unknown (HELO ?138.231.81.43?) (romain%bardou.fr@138.231.81.43) by ns0.ovh.net with SMTP; 15 Sep 2011 11:24:17 +0200 Message-ID: <4E71C417.1090706@lri.fr> Date: Thu, 15 Sep 2011 11:23:35 +0200 From: Romain Bardou User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.20) Gecko/20110820 Icedove/3.1.12 MIME-Version: 1.0 To: =?ISO-8859-1?Q?St=E9phane_Glondu?= CC: jeremie@dimino.org, OCaml List X-Ovh-Mailout: 178.32.228.3 (mo3.mail-out.ovh.net) 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> <4E70DCC4.1030102@glondu.net> <4E71BC0C.1090607@lri.fr> <4E71C36D.5030207@glondu.net> In-Reply-To: <4E71C36D.5030207@glondu.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 14141584305164052995 X-Ovh-Remote: 138.231.81.43 () X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.5/N X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -230 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfedvkedrtdduucetggdotefuucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmneculddquddttddmnehiodhhrgguucguohhnvgikrghmuchsuhhrvgcuthhhrghtkihhohhpvgcuhihouhikhhgrvhgvuchrvggtvghivhgvugikmhhighhhthculddqvddtmdenlhhinhhugiculddquddtmd X-Validation-by: bardou@lri.fr Subject: Re: [Caml-list] Link a .so/.dll dynamically Le 15/09/2011 11:20, Stéphane Glondu a écrit : > On 09/15/2011 10:49 AM, Romain Bardou wrote: >> Thanks, I tried the following combinations (with the bytecode version, >> not the native one): >> >> -cclib -l$(DLLPATH)$(DLLNAME)$(DLLEXT) >> -cclib -L$(DLLPATH) -cclib -l$(DLLNAME)$(DLLEXT) >> -L$(DLLPATH) -cclib -l$(DLLNAME)$(DLLEXT) >> -cclib -l$(DLLPATH)$(DLLNAME) >> -cclib -L$(DLLPATH) -cclib -l$(DLLNAME) >> -L$(DLLPATH) -cclib -l$(DLLNAME) >> >> Where $(DLLPATH) is the full path to my driver, such as /usr/lib/, >> $(DLLNAME) is driver file name without the extension, such as driver, >> and $(DLLEXT) is the extension, such as .so, such that the full .so path >> is /usr/lib/driver.so. > > "-l$(DLLNAME)" refers to "lib$(DLLNAME).so". It is to be used with > system shared libraries that use that convention. If you want to link to > something not using this convention, using the full path (without -l/-L) > might work on Linux, but keep in mind that not using lib$(DLLNAME).so > might be on purpose (e.g. to suggest that this .so should be dlopen()-ed > and not ld-linked). > >> None of them works; I still get the "undefined symbol" error. The option >> does appear with ocamlobjinfo though. For instance, here is the result >> of ocamlobjinfo on the .cma using the last command: >> >> Extra C object files: -lcryptoki -ldriver >> Extra C options: -L/usr/lib/ >> Extra dynamically-loaded libraries: -lcryptoki >> >> Shouldn't the -ldriver option appear in the extra dynamically-loaded >> libraries as well? > > Where does cryptoki come from? Oups, please replace cryptoki by mylib here :p (Cryptoki is another name for PKCS#11, which is the API I want to implement my bindings for) >> I might try Jeremie's more direct approach if everything else fails. > > Actually, I should have read more carefully your first mail... Jeremie's > (and Daniel's) approach are clearly the way to go: write a C stub around > dlopen() once and for all. I was instead thinking about drivers written > in OCaml that were using system shared libraries in my replies. Okay then :p Thanks, -- Romain