From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 86B647F64A for ; Fri, 8 Jan 2016 15:14:27 +0100 (CET) IronPort-PHdr: 9a23:xnrnjhD02k3j7IzOYi3MUyQJP3N1i/DPJgcQr6AfoPdwSP74pcbcNUDSrc9gkEXOFd2CrakU1ayO6+jJYi8p39WoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd6MyZzvn8mJuLTtICxwzAKnZr1zKBjk5S7wjeIxxbVYF6Aq1xHSqWFJcekFjUlhJFaUggqurpzopM0roGxsvKcq/stEFKH7ZLgQTLpCDT1gPXpmytfssEzmRA+E4X8ZGkAfjhNMAAGNuBT/V4v4tijznuV40Siee8bxSOZnCnyZ8653RUqw2288PDkj/TSPhw== Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=mmatalka@gmail.com; spf=Pass smtp.mailfrom=mmatalka@gmail.com; spf=None smtp.helo=postmaster@mail-wm0-f41.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mmatalka@gmail.com) identity=pra; client-ip=74.125.82.41; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="mmatalka@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of mmatalka@gmail.com designates 74.125.82.41 as permitted sender) identity=mailfrom; client-ip=74.125.82.41; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="mmatalka@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-wm0-f41.google.com) identity=helo; client-ip=74.125.82.41; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="postmaster@mail-wm0-f41.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0B0AADBw49WlClSfUpehHmIWaIHBAOHC4pFAQ2BZIcvOBQBAQEBAQEBARABAQEBBwsLCR8wgi2CIBUZARseAxIQFjQBBA8RAQUBV4d3AQMSBKEvggeBMT4xjTKCeYgTChknDVeCRgEFDoZIiiKEGQWXDYEPjEmJGIVjjQI1gRcgAQGCUxUHgV1yhWEBAQE X-IPAS-Result: A0B0AADBw49WlClSfUpehHmIWaIHBAOHC4pFAQ2BZIcvOBQBAQEBAQEBARABAQEBBwsLCR8wgi2CIBUZARseAxIQFjQBBA8RAQUBV4d3AQMSBKEvggeBMT4xjTKCeYgTChknDVeCRgEFDoZIiiKEGQWXDYEPjEmJGIVjjQI1gRcgAQGCUxUHgV1yhWEBAQE X-IronPort-AV: E=Sophos;i="5.20,538,1444687200"; d="scan'208";a="196292659" Received: from mail-wm0-f41.google.com ([74.125.82.41]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 08 Jan 2016 15:14:27 +0100 Received: by mail-wm0-f41.google.com with SMTP id f206so136604580wmf.0 for ; Fri, 08 Jan 2016 06:14:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type; bh=IxCxMAk9U6fPtMXNi8FHGnI8m+h148XqNk/HhX/q2uo=; b=WB5DxKbk/tu7pejgZx9gU98ncC4SABDy+B1cmz66/+UaQnbcmhmfYy5qJ/vGW00RB5 YQUwh+S5UFNmR/bdPcsu3Rwibws+erERdbTzb0RKtnwjvZ/2DqPMftrznFpiA0L3mkPp m5FU/rBPDxBuhMP9pRn83+1/ookDJVPFZhSHYOa/5p0FnDWwCc80jvmDxLvv5EuB/piE i/0qh4W+EIo2K8ilfAAlrvXqyvKNlQUquw8Lwfa1d+v6yrgx2RNo69SbGYWo41VHaald Jf5QSa3q0pHdzKhZ84e3/ZsKb/OKu0fJD/BwyoP+jg3fNzz9wrU34lm15qfV8DQWX0EC YGjQ== X-Received: by 10.194.118.162 with SMTP id kn2mr72523629wjb.148.1452262466778; Fri, 08 Jan 2016 06:14:26 -0800 (PST) Received: from localhost (li195-236.members.linode.com. [178.79.139.236]) by smtp.gmail.com with ESMTPSA id bg10sm105976794wjb.46.2016.01.08.06.14.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jan 2016 06:14:25 -0800 (PST) From: Malcolm Matalka To: caml-list@inria.fr Date: Fri, 08 Jan 2016 14:14:22 +0000 Message-ID: <86r3hsnoox.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Subject: [Caml-list] Including a C library statically in an Ocaml library The core problem I am having is a C library I want to bind has a number of macros which I need the value of. Here is how I am trying to solve it, but perhaps there is a better way: I have a small C library which gets compiled to libfoo.a which provides functions that return the macro values, like: int macro1() { return MACRO1; } I then have an ocaml library, called ofoo, that uses Ctypes to bind to macro1: let macro1 = foreign "macro" (void @-> returning int) Where I am having issues is this small library, I'd prefer it to not have to be installed on the system but just compiled into the Ocaml library so that a user just has to link against that library. Right now, none of the symbols (macro1) are being included in the library, I'm guessing because the linker sees no direct use of them. And I'm not even sure if I can get it included in the ocaml library. I'm also not able to get the libfoo symbols linked into a final executable, I'm guessing for similar reasons. What are my options here? If I've missed any useful information, let me know. I haven't interoped much with C directory in Ocaml so I'm not sure what information is important. /Malcolm