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 044697F890 for ; Tue, 25 Mar 2014 16:11:54 +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: AogBAJebMVMmacjlnGdsb2JhbABZg0FXrAWWaIESHg4BAQEBAQYWCTyCJQEBAQRAAQEsCwEPCwsDCg0hIQESAQUBChIGExKHUwMRAwIIoGKLGIRVAQWXHAMKhzIRBoxSghwHhDiWZIFtgTKLNoNbGCmEeA X-IPAS-Result: AogBAJebMVMmacjlnGdsb2JhbABZg0FXrAWWaIESHg4BAQEBAQYWCTyCJQEBAQRAAQEsCwEPCwsDCg0hIQESAQUBChIGExKHUwMRAwIIoGKLGIRVAQWXHAMKhzIRBoxSghwHhDiWZIFtgTKLNoNbGCmEeA X-IronPort-AV: E=Sophos;i="4.97,728,1389740400"; d="scan'208";a="64671025" 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 16:11:53 +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 1WST15-0006fh-5H for caml-list@inria.fr; Tue, 25 Mar 2014 11:11:51 -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 1WST15-0000co-47 for caml-list@inria.fr; Tue, 25 Mar 2014 11:11:51 -0400 Received: from mail-qg0-f42.google.com ([209.85.192.42]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1WST15-00016N-0x for caml-list@inria.fr; Tue, 25 Mar 2014 11:11:51 -0400 Received: by mail-qg0-f42.google.com with SMTP id q107so1753432qgd.1 for ; Tue, 25 Mar 2014 08:11:50 -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=UH6fYwUpXeOmtjD60j7KZax6ljY9qeWZap+7sT3R9FA=; b=Kp3nqqCuCZl7TaUPfh7D02EXq/+DSeoQGkx/8AfUJJnkMYGmDTrEf/TSc1fmxv3PYd 57EdYDeepiVbk1XrryazAyauAK4mPOPj9+1Jis5cewexakLShwk1S5GoI1LXn8luVbYw tyNTDafxV5kPKmtP9491qkGPzp2YRjo/4qr1E= 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=UH6fYwUpXeOmtjD60j7KZax6ljY9qeWZap+7sT3R9FA=; b=Pga6460vu3SMXyKvVd8/UdcOMX8bpEKTC4LX0DliyqQyWvJlViACyvgxpXWejI6GhT FrfiRpxQ41428rJlmrRy+zfkf3FTCXc8YzxTetIdFi78lmFnCaxu0IKANwLrgez4ztIV dzi5a04Zuua847MIe2BrSP3kI2O6WNJ0DDbRUxBzqY3FtbuZQNyYjUiZ21CtjULttZ/U ozaCQmNLoPXqI8BK1piK9L9v8GuymDYjkuocUKyqvvlT1NCK9CzLXavF+Fw+COkWBf6L aQn+K6UP2bwsDpJ/W0KTGwsMXB1PSlQ7qukQ3ukn+sFU9L/A5EpjbRNbnIZ6/uwYUBpm xRpw== X-Gm-Message-State: ALoCoQnl5Le3s3bGyJj2D7Imc6RGDoTRvo03aR0bFHZT0q7YhV0Fwts/qKu/LUEI2wMzsRbak4rya01Z2lGUflpwRHsUK7dz+/S1N24NnBw3ZY+M5GQPYSGqDYXGQ2V2TLW7hsDMMSdJdVCqtbkdLmsAkSsV5QsoEA== X-Received: by 10.229.17.69 with SMTP id r5mr2277130qca.7.1395760310835; Tue, 25 Mar 2014 08:11:50 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.229.17.69 with SMTP id r5mr2277109qca.7.1395760310710; Tue, 25 Mar 2014 08:11:50 -0700 (PDT) Received: by 10.224.73.6 with HTTP; Tue, 25 Mar 2014 08:11:50 -0700 (PDT) In-Reply-To: References: Date: Tue, 25 Mar 2014 11:11:50 -0400 Message-ID: From: Dan Benjamin To: Bruno Deferrari Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] Static linking via Ctypes? 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? 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