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 3F13F7F890 for ; Tue, 25 Mar 2014 16:24:57 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of kosmo.zb@gmail.com) identity=pra; client-ip=209.85.217.169; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="kosmo.zb@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of kosmo.zb@gmail.com designates 209.85.217.169 as permitted sender) identity=mailfrom; client-ip=209.85.217.169; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="kosmo.zb@gmail.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@mail-lb0-f169.google.com) identity=helo; client-ip=209.85.217.169; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="postmaster@mail-lb0-f169.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArQGABafMVPRVdmplGdsb2JhbABZg0FXrAUHl3MIFg4BAQEBBwsLCRIqgiUBAQEDAUABLQsBAwELAQUFCwMKDSEhARIBBQEKEgYTEodTAwkIDaBuj22WficDCleGWxEBBQyMRoZbBJZggW2BMos2g1sYKYFngnU9 X-IPAS-Result: ArQGABafMVPRVdmplGdsb2JhbABZg0FXrAUHl3MIFg4BAQEBBwsLCRIqgiUBAQEDAUABLQsBAwELAQUFCwMKDSEhARIBBQEKEgYTEodTAwkIDaBuj22WficDCleGWxEBBQyMRoZbBJZggW2BMos2g1sYKYFngnU9 X-IronPort-AV: E=Sophos;i="4.97,728,1389740400"; d="scan'208";a="64674131" Received: from mail-lb0-f169.google.com ([209.85.217.169]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 25 Mar 2014 16:24:56 +0100 Received: by mail-lb0-f169.google.com with SMTP id q8so507191lbi.28 for ; Tue, 25 Mar 2014 08:24:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=o9sHNAWQPnGcv1VQuj/GK6HGE5nrVj4lUX4NFZSYn5I=; b=KeE7cH8RaZFg6b3o/hvw9aKR94UxpRPl0A/fiBh4660NFnrvkwIhVuOzJGbjzrQUVh ihMMc3CLViCH8tFR/C/o6iOncdiQCFAKgRQtE3GVQsDxIf8pZxTYkAxuEK0k4UcWL5V8 KNjWG6Odalh7bV64dCirygiNStya3LhxudYqGo0Mr35GB9ay6FVRGhaXZoCZBQE4Q1xu Xn3Djev917cnRuG0r8Dsw3fGoNkMbDLReElB9wk5W/Jms+nlxtGHjpWsRQfx/JO0GFUI 5L7FgeaBoW529gER60t6rfo1Xyt4iPS4yPSX0d5flxNQm6qYHeMMpa9vLkuM9kMN/BdZ qEyg== MIME-Version: 1.0 X-Received: by 10.152.225.70 with SMTP id ri6mr50292924lac.26.1395761095631; Tue, 25 Mar 2014 08:24:55 -0700 (PDT) Sender: kosmo.zb@gmail.com Received: by 10.112.134.10 with HTTP; Tue, 25 Mar 2014 08:24:55 -0700 (PDT) In-Reply-To: References: Date: Tue, 25 Mar 2014 15:24:55 +0000 X-Google-Sender-Auth: C38MTf0ae46Wk2H1Qx7c7zFvC-M Message-ID: From: David Sheets To: Dan Benjamin Cc: Bruno Deferrari , O Caml Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] Static linking via Ctypes? 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