From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id DBB677F890 for ; Tue, 25 Mar 2014 16:10:58 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of daniel.buenzli@erratique.ch) identity=pra; client-ip=74.55.86.74; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="daniel.buenzli@erratique.ch"; x-sender="daniel.buenzli@erratique.ch"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of daniel.buenzli@erratique.ch) identity=mailfrom; client-ip=74.55.86.74; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="daniel.buenzli@erratique.ch"; x-sender="daniel.buenzli@erratique.ch"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@smtp.webfaction.com) identity=helo; client-ip=74.55.86.74; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="daniel.buenzli@erratique.ch"; x-sender="postmaster@smtp.webfaction.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUNAJebMVNKN1ZKnGdsb2JhbABZg0GCPoEgv2aBMA4BAQEBAQYNCQkUKIImAQEEI1YQCxoCJgICRxAZCIdxBAmscKJAF4EpjRIzBxaCWTWBFASZf4UDF48V X-IPAS-Result: ArUNAJebMVNKN1ZKnGdsb2JhbABZg0GCPoEgv2aBMA4BAQEBAQYNCQkUKIImAQEEI1YQCxoCJgICRxAZCIdxBAmscKJAF4EpjRIzBxaCWTWBFASZf4UDF48V X-IronPort-AV: E=Sophos;i="4.97,728,1389740400"; d="scan'208";a="64670665" Received: from mail6.webfaction.com (HELO smtp.webfaction.com) ([74.55.86.74]) by mail2-smtp-roc.national.inria.fr with ESMTP; 25 Mar 2014 16:10:58 +0100 Received: from [172.20.10.2] (221-228.197-178.cust.bluewin.ch [178.197.228.221]) by smtp.webfaction.com (Postfix) with ESMTP id 6BA302223777; Tue, 25 Mar 2014 15:10:54 +0000 (UTC) Date: Tue, 25 Mar 2014 16:10:52 +0100 From: =?utf-8?Q?Daniel_B=C3=BCnzli?= To: dbenjamin@janestreet.com Cc: caml-list@inria.fr Message-ID: <3744967737CD4861878DD3756D7970FD@erratique.ch> In-Reply-To: References: X-Mailer: sparrow 1.6.4 (build 1178) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: Re: [Caml-list] Static linking via Ctypes? Le mardi, 25 mars 2014 =C3=A0 15:54, dbenjamin@janestreet.com a =C3=A9crit : > I'm using Ctypes to interface with a dynamic library, but in addition to = the > interface provided the library I have some helper functions (written in C, > against the same library) that I'd also like to call via Ctypes. Is there= any > way to achieve this via static linking or am I required to build another > shared object? If you are using ctype's libffi backend you don't need in theory to build a= shared dllmylib.so shared object to put in ocaml's lib/stublib. However in= practice this is still useful to do even if that shared object is empty as= it allows you to record the correct link flags for the dlled C library you= bind to. Doing so allows your users to simply use the ocamlfind package o= r #require it in the toplevel and everything works correctly, no C link fla= gs to mess with when the binding is used. This empty dll could be the place to put your helper functions. See this co= mment on how to proceed: https://github.com/ocamllabs/ocaml-ctypes/issues/51#issuecomment-30729675 e.g. in that case you would put your helper functions in that empty tsdl_st= ub.c file.=20=20 Best, Daniel