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 89D907F8A3 for ; Tue, 25 Mar 2014 18:55:51 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of dbenjamin@janestreet.com) identity=pra; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dbenjamin@janestreet.com"; x-sender="dbenjamin@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of dbenjamin@janestreet.com designates 38.105.200.229 as permitted sender) identity=mailfrom; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dbenjamin@janestreet.com"; x-sender="dbenjamin@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mx5.mail.janestreet.com) identity=helo; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dbenjamin@janestreet.com"; x-sender="postmaster@mx5.mail.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AogBAHzCMVMmacjlnGdsb2JhbABZDoMzV6wFlmiBFB4OAQEBAQEGFgk8giUBAQEEQAEBLAsBDwsLDQ0hIQESAQUBChIGExKHUwMRAwIIoQmLGIRVAQWXGwMKhxURBoxSghwHhDiWZIFtgTKLNoNbGCmEHVs X-IPAS-Result: AogBAHzCMVMmacjlnGdsb2JhbABZDoMzV6wFlmiBFB4OAQEBAQEGFgk8giUBAQEEQAEBLAsBDwsLDQ0hIQESAQUBChIGExKHUwMRAwIIoQmLGIRVAQWXGwMKhxURBoxSghwHhDiWZIFtgTKLNoNbGCmEHVs X-IronPort-AV: E=Sophos;i="4.97,730,1389740400"; d="scan'208";a="64703465" Received: from mx5.janestreet.com (HELO mx5.mail.janestreet.com) ([38.105.200.229]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 25 Mar 2014 18:55:50 +0100 Received: from tot-oib-smtp1.delacy.com ([172.27.22.15] helo=tot-smtp) by mx5.mail.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1WSVZk-0006Tv-Ie for caml-list@inria.fr; Tue, 25 Mar 2014 13:55:48 -0400 Received: from tot-dmz-mxgoog1.delacy.com ([172.27.224.14] helo=mxgoog2.janestreet.com) by tot-smtp with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1WSVZk-0000FS-Hj for caml-list@inria.fr; Tue, 25 Mar 2014 13:55:48 -0400 Received: from mail-qc0-f173.google.com ([209.85.216.173]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1WSVZk-0007Pn-Eu for caml-list@inria.fr; Tue, 25 Mar 2014 13:55:48 -0400 Received: by mail-qc0-f173.google.com with SMTP id r5so1108189qcx.32 for ; Tue, 25 Mar 2014 10:55:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=vcGvwfFIpK1ve829Bpj6G9Sr0KUbkXheN4eyBdxuiuo=; b=pgC92GTWihf2u98ijREsu+neB6LdsM0cmPJ7182ndULg3rVBX6EyrxcCVfiaJh4f6+ VqDU9KRDuiFlrP2JeY047z4TE06YWeSDkEmBrSKuOWWB3K7B4atNyxr16wxY31oAOKEU YAaf67SvFELqn4W55QBmwY6+b/EdVSZ5fzKWk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=vcGvwfFIpK1ve829Bpj6G9Sr0KUbkXheN4eyBdxuiuo=; b=Cntk5e4s/KMZ93xiYHS67nhshTQe+ispzgEjUyudKhe3w64kHYfbsMn3Q/Ac27G/MJ wSxUtzR/HdFpi78aGiKYA4eq7r4q6hRlwCIdZxHBNHIkyQSq8ik8cmPSWr/kSlGb6H5q CSDJvNjCCusyvduH8mIaF9ayXZoAMBbKRYg40aRJJaez97FyVpge+wnR3kVkhX02jm1R WBpTBepzlfkv+6QuREL9NQ0M5cZEvljmOYvCA8bnbkdi4/KJHKPG0GalXTZCuGEx9b2P DpYEip5I9tfHWkfrwTK0TwrDZXNFF4cPOLjpAfC335BqeYi1ZQ9XJWr8gXAaQbhBMpo7 iCcQ== X-Gm-Message-State: ALoCoQk+hFLNXAvz8y2liQn9BQK9h1Tvyo4z5SbPUK+wzNtHpqXPIoUkDZe3kj+MstijnNwEyGkguUtYYuLKVVp87AVvy7ugVvWsFX2ilFKM4PT3PV/S0EettT5LqsL/fPm2FVSEjgPE3R4iIZxteezQZTaCO9+uUQ== X-Received: by 10.140.29.139 with SMTP id b11mr80117561qgb.48.1395770148243; Tue, 25 Mar 2014 10:55:48 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.140.29.139 with SMTP id b11mr80117553qgb.48.1395770148130; Tue, 25 Mar 2014 10:55:48 -0700 (PDT) Received: by 10.224.73.6 with HTTP; Tue, 25 Mar 2014 10:55:48 -0700 (PDT) In-Reply-To: References: Date: Tue, 25 Mar 2014 13:55:48 -0400 Message-ID: From: Dan Benjamin To: David Sheets Cc: Bruno Deferrari , O Caml Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] Static linking via Ctypes? That does work, thanks very much. Are there plans to add anything similar to Ctypes? On Tue, Mar 25, 2014 at 11:24 AM, David Sheets wrote: > On Tue, Mar 25, 2014 at 3:11 PM, Dan Benjamin wrote: >> I am passing -force_load, as well as --whole-archive (in case that >> makes a difference), and I have the following situation: >> >> - readelf -s shows that the function that I wish to call exists in the >> executable >> - running the executable results in Dl.DL_error("undefined symbol") >> for the same function, corresponding to the line of code where I call >> Foreign.foreign. >> >> Am I going about this wrongly? > > I did > > > > and > > > > to require a static link without stub generation in addition to > ocamlmklib on the .ml and .o files. > > Unfortunately, this is not very portable (or sane). I believe that > may be related. > > Hope this helps, > > David > >> On Tue, Mar 25, 2014 at 11:04 AM, Bruno Deferrari wrote: >>> On Tue, Mar 25, 2014 at 11:54 AM, wrote: >>>> 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? >>>> >>> >>> Static linking works. I was in this same situation yesterday, and >>> adding the .o files that were generated from C sources to the linking >>> step did the trick. >>> >>> If you are trying to link a .a file, you may have to pass the >>> -force_load option to the linker to force it to include it, otherwise >>> it may see that none of the symbols there are being referenced >>> directly and decide to not include it (this happened to me when using >>> clang in OSX). >>> >>>> -- >>>> Caml-list mailing list. Subscription management and archives: >>>> https://sympa.inria.fr/sympa/arc/caml-list >>>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >>>> Bug reports: http://caml.inria.fr/bin/caml-bugs >>> >>> >>> >>> -- >>> BD >> >> -- >> Caml-list mailing list. Subscription management and archives: >> https://sympa.inria.fr/sympa/arc/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs